Skip to content

Commit 46bbb06

Browse files
authored
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 })); ```
1 parent 17f9f68 commit 46bbb06

File tree

4 files changed

+1176
-463
lines changed

4 files changed

+1176
-463
lines changed

0 commit comments

Comments
 (0)