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