Angular unit tests TypeError: this.http.get(…).pipe is not a function
I'm following this example to make a unit test for service (get request coming from spring app backend) https://angular.io/guide/testing#testing-http-services Service class : @Injectable() export class TarifService { constructor(private messageService: MessageService, private http: HttpClient) { } public getTarifs(): Observable<Tarif[]> { return this.http.get<Tarif[]>(tarifffsURL).pipe( tap(() => {}), catchError(this.handleError('getTarifs', [])) ); } } Unit Test describe('TarifService', () => { let tarifService: TarifService; let httpClientSpy: { get: jasmine.Spy }; let expectedTarifs;