(responseFactory)
| 140 | } |
| 141 | |
| 142 | function mockFetch(responseFactory) { |
| 143 | const calls = []; |
| 144 | const fn = async (url, opts) => { |
| 145 | calls.push({ url: String(url), opts }); |
| 146 | return responseFactory(calls.length); |
| 147 | }; |
| 148 | fn.calls = calls; |
| 149 | return fn; |
| 150 | } |
| 151 | |
| 152 | function responseFromJson({ status = 200, json = {}, headers = {} } = {}) { |
| 153 | return { |
no outgoing calls
no test coverage detected