(responseFactory)
| 65 | } |
| 66 | |
| 67 | function mockFetch(responseFactory) { |
| 68 | const calls = []; |
| 69 | const fn = async (url, opts) => { |
| 70 | calls.push({ url, opts }); |
| 71 | return responseFactory(calls.length, opts); |
| 72 | }; |
| 73 | fn.calls = calls; |
| 74 | return fn; |
| 75 | } |
| 76 | |
| 77 | function responseFromJson({ status = 200, json = {} } = {}) { |
| 78 | return { |
no outgoing calls
no test coverage detected