wheresrhys / fetch-mock-jest

Jest wrapper for fetch-mock, a comprehensive stub for fetch

Home Page:http://www.wheresrhys.co.uk/fetch-mock/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`expect(fetch).toHaveBeenCalledWith(<url>)` doesn't work because it also receives undefined as second argument

julienw opened this issue · comments

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?