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

Function withFakeEvomapDir

test/lifecycleNodeIdLegacyFallback.test.js:90–104  ·  view source on GitHub ↗
(dir, body)

Source from the content-addressed store, hash-verified

88// The reader routes through `paths.getEvomapDir()`, which honours
89// EVOLVER_HOME first, so this redirects both reader and writer in lockstep.
90async function withFakeEvomapDir(dir, body) {
91 const _origHome = process.env.EVOLVER_HOME;
92 const _origFetch = global.fetch;
93 process.env.EVOLVER_HOME = dir;
94 _resetCachedNodeIdForTesting();
95 try {
96 return await body();
97 } finally {
98 if (_origHome === undefined) delete process.env.EVOLVER_HOME;
99 else process.env.EVOLVER_HOME = _origHome;
100 global.fetch = _origFetch;
101 _resetCachedNodeIdForTesting();
102 fs.rmSync(dir, { recursive: true, force: true });
103 }
104}
105
106test('hello reuses legacy ~/.evomap/node_id when store has none', async () => {
107 const dir = makeFakeEvomapDir((evomap) => {

Calls

no outgoing calls

Tested by

no test coverage detected