({ onSend }: { onSend: (request: MockXhrRequest, ...args: any[]) => any })
| 21 | // const realFetch = fetch; |
| 22 | |
| 23 | export const mockNetwork = ({ onSend }: { onSend: (request: MockXhrRequest, ...args: any[]) => any }) => { |
| 24 | const mockXhr = newMockXhr(); |
| 25 | const originalOnSend = onSend || mockXhr.onSend; |
| 26 | mockXhr.onSend = function (request, ...args: any[]) { |
| 27 | // @ts-ignore |
| 28 | const ret = originalOnSend?.apply(this, [request, ...args]); |
| 29 | setNetworkRequestCounter(request.url); |
| 30 | return ret; |
| 31 | }; |
| 32 | return { mockXhr }; |
| 33 | }; |
no test coverage detected