MCPcopy Create free account
hub / github.com/EvoMap/evolver / loadProxyWithHubFetch

Function loadProxyWithHubFetch

test/proxyHubFetchRouting.test.js:15–39  ·  view source on GitHub ↗
(hubFetchImpl)

Source from the content-addressed store, hash-verified

13}
14
15function 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
41test('EvoMapProxy._proxyHttp routes Hub passthrough through hubFetch', async () => {
42 const calls = [];

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected