(responseFactory)
| 34 | } |
| 35 | |
| 36 | function mockFetch(responseFactory) { |
| 37 | const calls = []; |
| 38 | const fn = async (url, opts) => { |
| 39 | calls.push({ url, opts }); |
| 40 | return responseFactory(calls.length); |
| 41 | }; |
| 42 | fn.calls = calls; |
| 43 | return fn; |
| 44 | } |
| 45 | |
| 46 | function responseFromJson({ status = 200, json = {}, headers = {} } = {}) { |
| 47 | return { |
no outgoing calls
no test coverage detected