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

Function installA2aProtocolStub

test/stakeBootstrap.test.js:20–43  ·  view source on GitHub ↗
(nodeId, hubUrl)

Source from the content-addressed store, hash-verified

18}
19
20function installA2aProtocolStub(nodeId, hubUrl) {
21 const target = require.resolve('../src/gep/a2aProtocol');
22 const sbPath = require.resolve('../src/gep/validator/stakeBootstrap');
23 delete require.cache[target];
24 delete require.cache[sbPath];
25 const origLoad = Module._load;
26 Module._load = function (request, parent, isMain) {
27 let resolved = null;
28 try { resolved = Module._resolveFilename(request, parent, isMain); } catch (_) {}
29 if (resolved === target) {
30 return {
31 buildHubHeaders: () => ({ 'content-type': 'application/json' }),
32 getHubUrl: () => hubUrl,
33 getNodeId: () => nodeId,
34 };
35 }
36 return origLoad.apply(this, arguments);
37 };
38 return () => {
39 Module._load = origLoad;
40 delete require.cache[target];
41 delete require.cache[sbPath];
42 };
43}
44
45describe('stakeBootstrap retry state machine', function () {
46 let restoreFetch;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected