{"id":14862207,"url":"https://github.com/remscodes/ngx-testing-tools","last_synced_at":"2025-04-08T20:53:41.798Z","repository":{"id":213017201,"uuid":"732767837","full_name":"remscodes/ngx-testing-tools","owner":"remscodes","description":"🛠️ Provides high-level utilities and reduces boilerplate for testing Angular applications","archived":false,"fork":false,"pushed_at":"2025-04-04T16:27:37.000Z","size":2779,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T11:02:16.255Z","etag":null,"topics":["angular","angular15","angular16","angular17","angular18","testing","testing-library","tools","typescript"],"latest_commit_sha":null,"homepage":"https://remscodes.github.io/ngx-testing-tools","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/remscodes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"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-12-17T19:04:02.000Z","updated_at":"2025-04-04T16:27:40.000Z","dependencies_parsed_at":"2024-01-24T01:28:20.326Z","dependency_job_id":"592cdc9f-8a2a-408b-bc51-7139b19ce9d7","html_url":"https://github.com/remscodes/ngx-testing-tools","commit_stats":{"total_commits":234,"total_committers":2,"mean_commits":117.0,"dds":"0.47435897435897434","last_synced_commit":"47c111fdac8d41c4322bfbf3baa0289521b3dac5"},"previous_names":["remscodes/ngx-testing-extra"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remscodes%2Fngx-testing-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remscodes%2Fngx-testing-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remscodes%2Fngx-testing-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/remscodes%2Fngx-testing-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/remscodes","download_url":"https://codeload.github.com/remscodes/ngx-testing-tools/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247927287,"owners_count":21019506,"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","angular15","angular16","angular17","angular18","testing","testing-library","tools","typescript"],"created_at":"2024-09-19T20:01:32.140Z","updated_at":"2025-04-08T20:53:41.776Z","avatar_url":"https://github.com/remscodes.png","language":"TypeScript","readme":"\u003cdiv align=\"center\"\u003e\n    \u003ch1\u003eAngular Testing Tools\u003c/h1\u003e\n    \u003cp\u003eMakes Angular testing easier\u003c/p\u003e\n\u003c/div\u003e \n\n\u003cdiv align=\"center\"\u003e\n\n[![github ci](https://img.shields.io/github/actions/workflow/status/remscodes/ngx-testing-tools/npm-ci.yml.svg?logo=github\u0026label=CI\u0026style=for-the-badge)](https://github.com/remscodes/ngx-testing-tools/actions/workflows/npm-ci.yml)\n[![codecov coverage](https://img.shields.io/codecov/c/github/remscodes/ngx-testing-tools/main.svg?style=for-the-badge\u0026logo=codecov)](https://codecov.io/gh/remscodes/ngx-testing-tools)\n[![npm version](https://img.shields.io/npm/v/ngx-testing-tools.svg?style=for-the-badge\u0026logo=npm)](https://www.npmjs.org/package/ngx-testing-tools)\n[![bundle size](https://img.shields.io/bundlephobia/minzip/ngx-testing-tools.svg?style=for-the-badge)](https://bundlephobia.com/package/ngx-testing-tools)\n[![license](https://img.shields.io/github/license/remscodes/ngx-testing-tools.svg?style=for-the-badge)](LICENSE)\n\n\u003c/div\u003e\n\n## In a nutshell\n\nThis library aims to **reduce boilerplate** 😎 and **provides high-level tools**️ 🔥 for testing Component, Guard, Interceptor and everything else related to the Angular mechanism.\n\nIt makes tests **easier to read** 😌 and **faster to write** ⚡️!\n\n## Quick examples\n\n#### Testing Component\n\n```ts\ndescribe('AppComponent', () =\u003e {\n  const tb = componentTestBed(AppComponent) // 🛠️ Create the test bed which is re-compiled for each test\n    .inject('prefs', Preferences); // 🖇️ Link a key to an injection for all tests, see below 👇\n\n  it('should render title', tb(({ component, query }) =\u003e { // 🔋 Access enhanced tools for testing components \n    expect(component.title).toEqual('app-v17');\n    const span = query.findElement('.content span');\n    expect(span.textContent).toContain('app-v17 app is running!');\n  }));\n\n  it('should update preferences on click', tb(({ action, injected: { prefs } }) =\u003e { // 🤯 Retrieve injections by autocompletion\n    expect(prefs.approved).toBeFalse();\n    action.click('#my-button');\n    expect(prefs.approved).toBeTrue();\n  }));\n});\n```\n\n🫡 (The redundant \"should create\" test is even called up for you!)\n\n#### Testing Service\n\n```ts\ndescribe('AppService', () =\u003e {\n  const tb = serviceTestBed(AppService, { httpTesting: true }); // 🛠️ Create the test bed and enable http testing\n\n  it('should fetch cat fact', tb(({ service, http, rx }, done) =\u003e {\n    const mockRes = { fact: 'string', length: 6 };\n\n    rx.remind = service.getCatFact().subscribe({ // 🧯 Use rx.remind to auto unsubscribe after the end of the test\n      next: (res) =\u003e {\n        expect(res).toEqual(mockRes);\n        done();\n      },\n    });\n\n    http.emitSuccessResponse({ url: service.CAT_FACT_URL, body: mockRes }); // 🎭 Fake the http response of the request that matches the url\n  }));\n});\n```\n\n## Installation\n\n```shell\nnpm install --save-dev ngx-testing-tools\n```\n\n## Documentation\n\nVisit the docs at https://remscodes.github.io/ngx-testing-tools.\n\n## Demo\n\nCheck [demo](./projects/ngx-testing-tools-demo) `.spec.ts` files.\n\n## Version compatibility\n\nCompatible with Angular `\u003e= 15.2.x`.\n\n## What's next ? 🤩\n\n- More custom test beds :\n  - `ResolverTestBed`\n- Mocks\n- Angular schematics\n\n## License\n\n[MIT](LICENSE) © Rémy Abitbol.\n","funding_links":[],"categories":["Testing"],"sub_categories":["Helpers"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremscodes%2Fngx-testing-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fremscodes%2Fngx-testing-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fremscodes%2Fngx-testing-tools/lists"}