(dir, body)
| 88 | // The reader routes through `paths.getEvomapDir()`, which honours |
| 89 | // EVOLVER_HOME first, so this redirects both reader and writer in lockstep. |
| 90 | async 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 | |
| 106 | test('hello reuses legacy ~/.evomap/node_id when store has none', async () => { |
| 107 | const dir = makeFakeEvomapDir((evomap) => { |
no outgoing calls
no test coverage detected