fetch-mock-jest
fetch-mock-jest copied to clipboard
`expect(fetch).toHaveBeenCalledWith(<url>)` doesn't work because it also receives undefined as second argument
The README says:
All the built in jest function inspection assertions can be used, e.g.
expect(fetchMock).toHaveBeenCalledWith('http://example.com').
But that doesn't work, indeed it looks like the mock always receives undefined as the second argument, and as a result this fails.
I've noticed this as well. This is a great extension of fetchMock, but errors aren't readable. I've got:
Last call to fetch should have had a URL of http://... but was undefined
That's because lastCall here is an array [url, options] instead of object {url, options}. @wheresrhys @skovhus, any chance you have time to fix this issue?