The reason for "NullInjectorError: No provider for HttpClient!" are unresolved dependencies. In this case the lack of a HttpClientModule.
In your .service.spec.ts file add
imports: [
HttpClientTestingModule,
],
You might notice that I wrote HttpClientTestingModule instead of HttpClientModule. The reason is that we don’t want to send actual http requests, but rather use a Mock API of the test framework.