| 1 | import assert from "node:assert/strict"; |
| 2 | import test from "node:test"; |
| 3 | import { needsProxySetup } from "./onboarding-state.mjs"; |
| 4 | |
| 5 | test("only an applied Cage node completes setup", () => { |
| 6 | assert.equal(needsProxySetup({}, {}, {}), true); |
| 7 | assert.equal( |
| 8 | needsProxySetup({}, {}, { active: false, selected: "node" }), |
| 9 | true, |
| 10 | ); |
| 11 | assert.equal( |
| 12 | needsProxySetup({}, {}, { active: true, selected: "node" }), |
| 13 | false, |
| 14 | ); |
| 15 | }); |
| 16 | test("running VM, old endpoint and restore file cannot bypass node setup", () => { |
| 17 | for (const status of [{ vm_running: true }, { can_restore: true }]) { |
| 18 | assert.equal( |
| 19 | needsProxySetup({ proxy_url: "socks5://127.0.0.1:17896" }, status, {}), |
| 20 | true, |
| 21 | ); |
| 22 | } |
| 23 | }); |