I try to make a spy on a generic method in typescript,
but cannot get Jasmine to recognise it.
I have code
http: HttpClient <- Not proper code, just showing type.
...
this.http.get<Customer[]>(url);
where I want to mock the get<...>
method.
const httpMock = {} as HttpClient;
spyOn(httpMock, 'get')
.and.returnValue(of({} as Customer[]));
But when I run the test I get
Error: : get() method does not exist
Usage: spyOn(, )
Aucun commentaire:
Enregistrer un commentaire