Open boazhoch opened 6 years ago
Did you manage to fix this? I finally had some time recently to look through the example. I'm a bit confused why it's going into the .then
when it should just hit the catch
if you're rejecting.
Struggling with this here as well, always returns the value provided in the first test with mockOnce(...)
even for one of the tests where I use fetchMock.mockRejectOnce()
Looks like the request URL needs to be different to get different response. I find this quite confusing.
Setting a mock response in one test should not be returned in another test.
Even resetMocks()
has no effect.
Has anyone been able to work this one out? Running into this issue myself. The mocked response is always from the test run previously. resetMocks
doesn't seem to do anything.
For anyone stumbling upon this: Save yourself the hours of troubleshooting and just use msw: https://mswjs.io/docs/integrations/node/
resetMocks() in this lib definitely doesn't work which makes it useless for anyone developing real software tests.
So as the title implies
fetch.mockResets()
isn't resetting the the fetch.here is my full test.js:
The result i get is: