I am trying to test the following method
const httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json'
})
};
login(user, password) {
this.loadingLogin.next(true);
return this.http.post(this.loginUrl, JSON.stringify({
user,
password
}), this.httpOptions)
.pipe(
catchError(error => this.errorHandleService.handleError('login', error)),
finalize(() => this.loadingLogin.next(false))
);
}
expect(httpMock.post.mock.calls[0][2]).toBe(httpOptions);
but when I go to run it, it gives the following error Object.is equality
- Expected - 1
+ Received + 3
- HttpHeaders {
+ Object {
+ "headers": HttpHeaders {
"lazyInit": [Function anonymous],
"lazyUpdate": null,
"normalizedNames": Map {},
+ },
}
what would be the correct syntax?
Aucun commentaire:
Enregistrer un commentaire