jest-fetch-mock
jest-fetch-mock copied to clipboard
Jest mock for fetch
mockAborted -> mockAbort mockAbortedOnce -> mockAbortOnce
The example usage given for `mockIf` is ``` fetchMock.mockIf(/^https?:\/\/example.com.*$/, req => { if (req.url.endsWith("/path1")) { return "some response body" } else if (req.url.endsWith("/path2")) { return { body: "another response body",...
Hi all! While executing tests in one of my private repositories, I've seen a weird behaviour which differs from the expected behaviour of native fetch. When executing the `fetch` function...
I have a unit test I'm converting over to use this library. Since the method I'm testing reads from Response.body like a stream (which follows the [fetch API docs](https://developer.mozilla.org/en-US/docs/Web/API/Response/body)), the...
After upgrading to NodeJS 16 I got some wierd issues in my tests that used jest-fetch-mock. With this simple test: ``` it('throws error on bad response from server', () =>...
Bumps [jsdom](https://github.com/jsdom/jsdom) from 16.4.0 to 16.7.0. Release notes Sourced from jsdom's releases. Version 16.7.0 Added AbortSignal.abort(). (ninevra) Added dummy x and y properties to the return value of getBoundingClientRect(). (eiko)...
[fetch](https://developer.mozilla.org/en-US/docs/Web/API/fetch) allows the first argument to be a Request or "A string or any other object with a [stringifier](https://developer.mozilla.org/en-US/docs/Glossary/Stringifier) — including a [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL) object — that provides the URL of...
I'm currently testing a project, which uses cross-fetch ponyfills in the files (i.e. `import fetch from "cross-fetch"`). [this comment](https://github.com/jefflau/jest-fetch-mock/issues/82#issuecomment-457826837) in #82 suggests just using cross-fetch as polyfill instead of ponyfill,...
I can't figure out why my jest mocks aren't working consistently. I understand the behavior about mocks being lifted, but I don't see how/why that would break my code in...
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6. Commits 7efb22a 1.2.6 ef88b93 security notice for additional prototype pollution issue c2b9819 isConstructorOrProto adapted from PR bc8ecee test from prototype pollution PR See full...