(hubFetchImpl)
| 13 | } |
| 14 | |
| 15 | function loadProxyWithHubFetch(hubFetchImpl) { |
| 16 | const hubFetchPath = require.resolve('../src/gep/hubFetch'); |
| 17 | const proxyPath = require.resolve('../src/proxy/index.js'); |
| 18 | const oldHubFetch = require.cache[hubFetchPath]; |
| 19 | const oldProxy = require.cache[proxyPath]; |
| 20 | |
| 21 | delete require.cache[proxyPath]; |
| 22 | require.cache[hubFetchPath] = { |
| 23 | id: hubFetchPath, |
| 24 | filename: hubFetchPath, |
| 25 | loaded: true, |
| 26 | exports: { hubFetch: hubFetchImpl }, |
| 27 | }; |
| 28 | |
| 29 | const proxyModule = require('../src/proxy/index.js'); |
| 30 | return { |
| 31 | proxyModule, |
| 32 | restore() { |
| 33 | if (oldProxy) require.cache[proxyPath] = oldProxy; |
| 34 | else delete require.cache[proxyPath]; |
| 35 | if (oldHubFetch) require.cache[hubFetchPath] = oldHubFetch; |
| 36 | else delete require.cache[hubFetchPath]; |
| 37 | }, |
| 38 | }; |
| 39 | } |
| 40 | |
| 41 | test('EvoMapProxy._proxyHttp routes Hub passthrough through hubFetch', async () => { |
| 42 | const calls = []; |
no outgoing calls
no test coverage detected