fetchMock.mock doesn't work as expected.
Closed this issue · 2 comments
Hi,
I found that fetchMock.mock
is a function instead of an object with keys like calls
and results
. I have found that fetchMock.fetchHandler.mock
is what I expected.
fetchMock.mock
looks like this
function(...args) {
setDebugPhase('setup');
if (args.length) {
this.addRoute(args);
}
return this._mock();
}
I was wondering this is expected.
Thanks for your help.
It should still have calls
and results
properties though as I merge the jest mock object and the fetch-mock mock function together https://github.com/wheresrhys/fetch-mock-jest/blob/master/jestify.js#L24
I've noticed in some projects that jest is erroring on this too, complaining that it's finding a proxy function not an object. I spent some time trying to figure out why it doesn't happen in this repo's test suite, but couldn't work it out
Fixed in 1.2.5 - thanks for the bug report