fix(common): http/testing expectOne lists the received requests if no matches (#27005)
Fixes #18013 Previously it was hard to debug an `expectOne` if the request had no match, as the error message was: Expected one matching request for criteria "Match URL: /some-url?query=hello", found none. This commit adds a bit more info to the error, by listing the actual requests received: Expected one matching request for criteria "Match URL: /some-url?query=hello", found none. Requests received are: POST /some-url?query=world. PR Close #27005
This commit is contained in:
@ -36,7 +36,9 @@ describe('HttpClient TestRequest', () => {
|
||||
fail();
|
||||
} catch (error) {
|
||||
expect(error.message)
|
||||
.toBe('Expected one matching request for criteria "Match URL: /some-url", found none.');
|
||||
.toBe(
|
||||
'Expected one matching request for criteria "Match URL: /some-url", found none.' +
|
||||
' Requests received are: GET /some-other-url.');
|
||||
}
|
||||
});
|
||||
|
||||
@ -55,7 +57,8 @@ describe('HttpClient TestRequest', () => {
|
||||
} catch (error) {
|
||||
expect(error.message)
|
||||
.toBe(
|
||||
'Expected one matching request for criteria "Match URL: /some-url?query=world", found none.');
|
||||
'Expected one matching request for criteria "Match URL: /some-url?query=world", found none.' +
|
||||
' Requests received are: GET /some-url?query=hello.');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user