Implement` toHaveRespondedWith`
Closed this issue · 3 comments
wheresrhys commented
toHaveRespondedWith(object | status | string )
(using fetch-mock internals to convert to a response config, then use jest objectMatching)
wheresrhys commented
fetch-mock itself does not provide any utilities for inspecting responses.
On the one hand it does feel useful to allow inspecting responses, but on the other hand, there are 2 cases to consider
- User has defined a mock response, in which case it's a bit odd to want to check the response that was sent as you would be testing that the mock - not the src - behaves as expected
- Spying on a real fetch response, but in this case it still feels a little odd to want to check things across the clear boundary that the server/client split makes
Will leave implementing anything in this space until real users request it with compelling reasons
JakeChampion commented
merry christmas git hub issue rhys
timomeh commented
@wheresrhys I totally agree with both of your considerations. Seems superfluous