{"id":22672822,"url":"https://github.com/jimlynchcodes/angular-14-http-unit-test","last_synced_at":"2026-03-19T23:23:49.784Z","repository":{"id":210322707,"uuid":"726286257","full_name":"JimLynchCodes/Angular-14-Http-Unit-Test","owner":"JimLynchCodes","description":null,"archived":false,"fork":false,"pushed_at":"2023-12-18T22:13:21.000Z","size":214,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-04T12:02:39.404Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","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/JimLynchCodes.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2023-12-02T00:15:19.000Z","updated_at":"2023-12-02T00:30:23.000Z","dependencies_parsed_at":"2023-12-19T01:25:50.966Z","dependency_job_id":"9b83ea21-22f7-4e6d-91f2-91f32fc36855","html_url":"https://github.com/JimLynchCodes/Angular-14-Http-Unit-Test","commit_stats":null,"previous_names":["jimlynchcodes/angular-14-http-unit-test"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JimLynchCodes%2FAngular-14-Http-Unit-Test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JimLynchCodes%2FAngular-14-Http-Unit-Test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JimLynchCodes%2FAngular-14-Http-Unit-Test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JimLynchCodes%2FAngular-14-Http-Unit-Test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JimLynchCodes","download_url":"https://codeload.github.com/JimLynchCodes/Angular-14-Http-Unit-Test/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246180890,"owners_count":20736459,"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":[],"created_at":"2024-12-09T16:22:46.182Z","updated_at":"2026-01-07T14:49:03.232Z","avatar_url":"https://github.com/JimLynchCodes.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Angular-14-Http-Unit-Test\n\nAn example of an Angular v14 project with a component that injects a service that uses HTTPClient to make a GET request.\n\n\n## Node Version\n\nUsed the latest v18 of node at the time (v18.19.0):\n```bash\nnvm i v18\n```\n\nor if you already have it installed:\n```bash\nnvm use v18\n```\n\n\n## Scaffolding\n\nScaffolded an Angular 14 project with this command:\n```bash\nnpx @angular/cli@14 new Angular14Project\n```\n\nwith these options:\n- no routing\n- scss\n\n\n## Data Stuff Service\n\nThe _DataStuffService_ gets stuff (calls an arbitrary free open api).\n\nThe test for the data service checks that the \"getStuff\" function returns the GET call response (but doesn't ACTUALLY make a http call).\n\nInitially scaffolded with:\n```bash\nnpm run ng g s DataStuff\n```\n\n\n## Data Stuff Component\n\nThe _DataStuffComponent_ injects the _DataStuffService_ and uses it to get data which it then renders on the page as a string. \n\nThe test for the DataStuffComponent uses a mocked version of the DataStuffService that has a \"getStuff\" function which just returns the hardcoded object `{ response: 'foobar' }`\n\nScaffolded with:\n```bash\nnpm run ng g c DataStuff\n```\n\n\n## Running Unit Tests With Code Coverage\n\n```bash\nnpm run test -- --code-coverage\n```\n\nThen open the `index.html` file located at `coverage/angular14-project` in your browser.\n\nUse the report to become aware of where your source code is missing unit tests.\n\n\n## Running Stryker\n\nThen, use it to run stryker's init command.\n```bash\nnpm run stryker -- init\n```\n\nThen open the `mutation.html` file located at `reports/mutation/mutation.html` in your browser.\n\nUse the report to become aware of where your unit tests are missing assertions.\n\n\n## How We Installed Stryker (Just FYI 😉)\n\nFirst, install stryker as a dev dependency:\n```bash\nnpm i -D stryker-cli\n```\n\nThen, use it to run stryker's init command.\n```bash\nnpm run stryker -- init\n```\n\nThen we answered the questions promts with these answers:\n\n- npm\n\n- angular-cli\n\n- javascript\n\n- npm\n\n\nExtra configuration was made to the generated stryker.config.mjs file:\n\n- added \"\"!src/main.ts\" to the \"mutate\" list.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimlynchcodes%2Fangular-14-http-unit-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjimlynchcodes%2Fangular-14-http-unit-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimlynchcodes%2Fangular-14-http-unit-test/lists"}