diff options
Diffstat (limited to 'packages/meshbay-node/tests/test_packaging_win.py')
| -rw-r--r-- | packages/meshbay-node/tests/test_packaging_win.py | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/packages/meshbay-node/tests/test_packaging_win.py b/packages/meshbay-node/tests/test_packaging_win.py index 1fe6be8..b5f6191 100644 --- a/packages/meshbay-node/tests/test_packaging_win.py +++ b/packages/meshbay-node/tests/test_packaging_win.py @@ -1625,11 +1625,27 @@ def test_a_declined_prompt_leaves_the_node_as_it_was(): def test_only_while_open_starts_with_the_app_and_stops_at_quit(): main_js = MAIN_JS.read_text(encoding="utf-8") - start = _fn_body(main_js, "async function winStartNodeWithApp()") + start = _fn_body(main_js, "async function winStartNodeWithAppOnce()") assert "winStartupMode()) !== 'open'" in start and "nodeProvisioned()" in start assert "winNodeStartVia(['autostart', 'start'])" in start ready = main_js.split("app.whenReady().then(", 1)[1] assert ready.index("createWindow();") < ready.index("nodeWithApp.start()") quit_ = main_js.split("app.on('before-quit', (event) => {", 1)[1].split("\n });", 1)[0] - assert "!nodeStartedByApp" in quit_ and "event.preventDefault()" in quit_ - assert "mode === 'open' ? killNodeProcesses()" in quit_ + assert "event.preventDefault()" in quit_ + assert "(await winStartupMode()) !== 'open'" in quit_ and "killNodeProcesses()" in quit_ + # Whoever started it: a node left by the sign-in launcher before the mode + # was switched ran on after Quit (found on a real install, 2026-10-08). + assert "!nodeStartedByApp" not in quit_ + assert "await probeNode() || (await winNodePids()).length" in quit_ + + +def test_one_start_at_a_time_at_launch(): + """The start with the app and the sign-in's own both ran `autostart start` + at once: three meshbay-node.exe were seen racing for the port.""" + main_js = MAIN_JS.read_text(encoding="utf-8") + once = _fn_body(main_js, "async function winStartNodeWithApp()") + assert "if (!nodeWithAppStart) nodeWithAppStart = winStartNodeWithAppOnce();" in once + ensure = _fn_body(main_js, "async function ensureNode(opts)") + assert ensure.index("await nodeWithAppStart") < ensure.index("provisionNode(") + start = main_js.split("handle('node:start'", 1)[1][:600] + assert "await nodeWithAppStart" in start |