{"id":13529703,"url":"https://github.com/lazycuh/angular-testing-kit","last_synced_at":"2026-02-09T04:34:25.044Z","repository":{"id":207713314,"uuid":"719905267","full_name":"lazycuh/angular-testing-kit","owner":"lazycuh","description":"A set of convenient utilities to make Angular testing with Jasmine and Karma simpler.","archived":false,"fork":false,"pushed_at":"2024-07-18T04:07:58.000Z","size":593,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-19T16:52:23.306Z","etag":null,"topics":["angular-component-testing","angular-jasmine-testing","angular-testing","angular-testing-kit","angular-unit-testing"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@lazycuh/angular-testing-kit","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lazycuh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-17T06:36:49.000Z","updated_at":"2024-07-18T04:08:00.000Z","dependencies_parsed_at":"2023-11-17T08:49:12.672Z","dependency_job_id":"0f1ba175-256b-4c8d-92bc-65f7cf86f8fa","html_url":"https://github.com/lazycuh/angular-testing-kit","commit_stats":null,"previous_names":["babybeet/angular-testing-kit","lazycuh/angular-testing-kit"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lazycuh%2Fangular-testing-kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lazycuh%2Fangular-testing-kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lazycuh%2Fangular-testing-kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lazycuh%2Fangular-testing-kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lazycuh","download_url":"https://codeload.github.com/lazycuh/angular-testing-kit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244734201,"owners_count":20501020,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular-component-testing","angular-jasmine-testing","angular-testing","angular-testing-kit","angular-unit-testing"],"created_at":"2024-08-01T07:00:38.666Z","updated_at":"2026-02-09T04:34:24.939Z","avatar_url":"https://github.com/lazycuh.png","language":"TypeScript","readme":"# angular-testing-kit [![](https://circleci.com/gh/lazycuh/angular-testing-kit.svg?style=svg\u0026logo=appveyor)](https://app.circleci.com/pipelines/github/lazycuh/angular-testing-kit?branch=main)\n\nA set of convenient utilities to make Angular testing with Jasmine and Karma simpler.\n\n## Table of contents\n\n\u003c!-- toc --\u003e\n\n- [Angular version compatibility](#angular-version-compatibility)\n- [Installation](#installation)\n- [`assertThat()`](#assertthat)\n  - [`.doesNotExist()`](#doesnotexist)\n    - [Example](#example)\n  - [`.exists()`](#exists)\n    - [Example](#example-1)\n  - [`.hasInnerHtml()`](#hasinnerhtml)\n    - [Example](#example-2)\n  - [`.hasTextContent()`](#hastextcontent)\n    - [Example](#example-3)\n  - [`.hasTextContentMatching()`](#hastextcontentmatching)\n    - [Example:](#example)\n- [`delayBy()`](#delayby)\n  - [Example](#example-4)\n- [`extractTextContent()`](#extracttextcontent)\n  - [Example](#example-5)\n- [`findElementBySelector()`](#findelementbyselector)\n  - [Example](#example-6)\n- [`fireEvent()`](#fireevent)\n  - [Example](#example-7)\n- [`getElementBySelector()`](#getelementbyselector)\n  - [Example](#example-8)\n\n\u003c!-- tocstop --\u003e\n\n## Angular version compatibility\n\n- 16+\n\n## Installation\n\n- `npm`\n  ```\n  npm i -S @lazycuh/angular-testing-kit\n  ```\n- `pnpm`\n  ```\n  pnpm i -S @lazycuh/angular-testing-kit\n  ```\n- `yarn`\n  ```\n  yarn add @lazycuh/angular-testing-kit\n  ```\n\n## `assertThat()`\n\nThis assertion function accepts either a string or a [`DebugElement`](https://angular.io/api/core/DebugElement), it returns an assertion object that can be used to check for different conditions. The returned assertion object has the following methods:\n\n### `.doesNotExist()`\n\nWill pass if no element with the provided class name exists in `document.body`.\n\n#### Example\n\n```ts\nassertThat('.hello-world').doesNotExist();\n```\n\n### `.exists()`\n\nWill pass if an element with the provided class name exists in `document.body`.\n\n#### Example\n\n```ts\nassertThat('.hello-world').exists();\n```\n\n### `.hasInnerHtml()`\n\nWill pass if an element with the provided class name has the provided inner HTML string.\n\n#### Example\n\n```ts\nassertThat('.hello-world').hasInnerHtml('\u003cspan\u003eHello World\u003c/span\u003e');\n```\n\n### `.hasTextContent()`\n\nWill pass if an element with the provided class name has the provided string as its text content.\n\n#### Example\n\n```ts\nassertThat('.hello-world').hasTextContent('Hello World');\n```\n\n### `.hasTextContentMatching()`\n\nWill pass if an element with the provided class name whose text content matches the provided value. This function also accepts a [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) to perform custom matching.\n\n#### Example:\n\n```ts\nassertThat('.hello-world').hasTextContentMatching(/hello\\s+world/i);\n```\n\n## `delayBy()`\n\nReturns a promise that will resolve after the provided milliseconds. Useful for when you need to wait for some asynchronous process to complete before proceeding.\n\n### Example\n\n```ts\nawait delayBy(500);\n```\n\n## `extractTextContent()`\n\nReturns the text content of the element matched by the provided selector. It will throw an error if the matched element\nis a `document` or `doctype` node because these nodes' `textContent` will be `null`. If no element is matched, then an error will be thrown.\n\n### Example\n\n```ts\nexpect(extractTextContent('.hello-world')).toEqual('Hello World');\n```\n\n## `findElementBySelector()`\n\nReturns the element matched by the provided selector. If nothing is matched, `null` is returned.\n\n### Example\n\n```ts\nexpect(findElementBySelector('.hello-world')).not.toBeNull();\n```\n\n## `fireEvent()`\n\nDispatch the given `eventType` DOM event on the target element matched by the provided selector.\nThe selector argument accepts 3 different types of value:\n\n- If it's a string, then it's treated as an HTML selector by which to find the target element\n  to fire the event on. If no element is found for the provided selector,\n  then an error will be thrown.\n- If it's an [`EventTarget`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget) such as [`Element`](https://developer.mozilla.org/en-US/docs/Web/API/Element) or [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window), then the event is fired directly on it.\n- If it's a [`DebugElement`](https://angular.io/api/core/DebugElement), then its native element will be dispatched the event on.\n\n### Example\n\n```ts\nfireEvent('.hello-world', 'keyup', { key: 'Enter' });\n```\n\n## `getElementBySelector()`\n\nReturns the element matched by the provided selector. If nothing is matched, an error is thrown.\n\n### Example\n\n```ts\nexpect(() =\u003e getElementBySelector('.hello-world')).not.toThrow();\n```\n","funding_links":[],"categories":["Testing","Recently Updated"],"sub_categories":["Component","[Jul 15, 2024](/content/2024/07/15/README.md)"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flazycuh%2Fangular-testing-kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flazycuh%2Fangular-testing-kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flazycuh%2Fangular-testing-kit/lists"}