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

Function loadProtocolWithSpy

test/forceUpdateIdempotent.test.js:379–401  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

377 var execCalls;
378
379 function loadProtocolWithSpy() {
380 // Rig the require cache so a2aProtocol picks up our spy executeForceUpdate
381 // instead of the real one. Mirrors the approach used in
382 // forceUpdateLastUpdateReport.test.js (see top-of-file cache rig there).
383 delete require.cache[a2aProtocolPath];
384 const realFU = require('../src/forceUpdate');
385 require.cache[forceUpdatePath] = {
386 id: forceUpdatePath,
387 filename: forceUpdatePath,
388 loaded: true,
389 exports: {
390 executeForceUpdate: function (fu) {
391 execCalls.push(fu);
392 // For no-op tests, return realFU.FORCE_UPDATE_NOOP — that's what the
393 // real implementation would return when current === required.
394 if (execReturn === '__NOOP__') return realFU.FORCE_UPDATE_NOOP;
395 return execReturn;
396 },
397 FORCE_UPDATE_NOOP: realFU.FORCE_UPDATE_NOOP,
398 },
399 };
400 return require('../src/gep/a2aProtocol');
401 }
402
403 before(() => {
404 if (!process.env.A2A_NODE_SECRET) process.env.A2A_NODE_SECRET = 'a'.repeat(64);

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected