Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow more types of overloads of mockResponse (#26)
This PR makes it possible to use more types of overloaded functions: ```ts fetch.mockResponseOnce('x'); fetch.mockResponseOnce({ body: 'x' }); // previously not allowed fetch.mockResponseOnce(new Response('x')); // previously not allowed fetch.mockResponseOnce(() => 'x'); fetch.mockResponseOnce(() => ({ body: 'x' })); fetch.mockResponseOnce(() => new Response('x')); fetch.mockResponseOnce(() => Promise.resolve('x')); fetch.mockResponseOnce(() => Promise.resolve({ body: 'x' })); fetch.mockResponseOnce(() => Promise.resolve(new Response('x'))); ``` This could make certain cases less awkward, like #25 (comment): ```ts fetch.mockResponseOnce({ status: 204 }); fetch.mockResponseOnce(new Response(null, { status: 204 })); ```
- Loading branch information