May 2018
Intermediate to advanced
512 pages
11h 3m
English
You still have errors remaining. Let's start by fixing the errors with the WeatherService error first, since it's a dependency of other components. The test is reporting a missing provider for HttpClient. However, we don't want our unit test to make calls over HTTP, so we shouldn't provide the HttpClient, like we did in the previous section. Angular provides a test double for HttpClient named HttpClientTestingModule. In order to leverage it, you must import it, and it will then be automatically provided to the service for you.
Import HttpClientTestingModule below the providers:
src/app/weather/weather.service.spec.tsimport { HttpClientTestingModule } from '@angular/common/http/testing' ...describe('WeatherService', () => { beforeEach(() ...Read now
Unlock full access