(dir, body)
| 115 | // cache — otherwise `_shortNodeIdForStatePath` would short-circuit on |
| 116 | // the cache before consulting the legacy file we are testing. |
| 117 | async function withFakeEvomapDir(dir, body) { |
| 118 | const _origHome = process.env.EVOLVER_HOME; |
| 119 | const _origFetch = global.fetch; |
| 120 | process.env.EVOLVER_HOME = dir; |
| 121 | _resetCachedNodeIdForTesting(); |
| 122 | try { |
| 123 | return await body(); |
| 124 | } finally { |
| 125 | if (_origHome === undefined) delete process.env.EVOLVER_HOME; |
| 126 | else process.env.EVOLVER_HOME = _origHome; |
| 127 | global.fetch = _origFetch; |
| 128 | _resetCachedNodeIdForTesting(); |
| 129 | _resetLastUpdateStateForTesting(); |
| 130 | fs.rmSync(dir, { recursive: true, force: true }); |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | test('proxy hello on a fresh install (no legacy file, no store) writes the minted id to ~/.evomap/node_id', async () => { |
| 135 | const dir = makeFakeEvomapDir(); |
no outgoing calls
no test coverage detected