我有以下服务:
creerPass(mail: string, person: string, password: string): Observable<void> {
const params = new HttpParams()
.set('person', person)
.set('mail', mail);
return this.http.patch(`/api/user/pwd`, { password: password}, { params: params }).pipe(
map(() => { }),
)
}
根据规格:
fit('should PATCH', () => {
const person = "joe";
const mail = "[email protected]"
const password = "fezioOkf"
passwordService.creerPass(mail, person, password).subscribe(() => { }, fail);
const req = http.expectOne('/api/user/pwd');
expect(req.request.method).toEqual('PATCH');
// http.expectOne({ method: 'PATCH', url: '/api/user/pwd?person=joe&[email protected]`' });
});
我收到以下错误:
Error: Expected one matching request for criteria "Match URL: api/user/pwd", found none.
如何使用参数和正文测试此请求?
之后