From f1ed3e6be452f6211cee8db1afef8b56473a04db Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Fri, 25 Sep 2026 10:23:05 +0200 Subject: test(hub): read the search code wherever it is split The Node harnesses take one file or several, and the tests that lift connectToGroup and the pool out of search-page.js as text take them from spa_source, which also reads connection-pool.js once it exists. Co-Authored-By: Claude Opus 5.5 --- packages/meshbay-hub/tests/test_transport_contracts.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'packages/meshbay-hub/tests/test_transport_contracts.py') diff --git a/packages/meshbay-hub/tests/test_transport_contracts.py b/packages/meshbay-hub/tests/test_transport_contracts.py index 28d6a10..76e8123 100644 --- a/packages/meshbay-hub/tests/test_transport_contracts.py +++ b/packages/meshbay-hub/tests/test_transport_contracts.py @@ -19,6 +19,7 @@ import re from pathlib import Path import pytest +from spa_source import search_source STATIC = Path(__file__).resolve().parents[1] / "src" / "meshbay_hub" / "static" TRANSPORT = STATIC / "transport.js" @@ -521,7 +522,7 @@ SEARCH_PAGE = STATIC / "search-page.js" def test_search_tries_every_node_the_hub_offers(): - code = _code_only(SEARCH_PAGE.read_text(encoding="utf-8")) + code = _code_only(search_source()) assert "nodes[0]" not in code, "Search takes the head of the node list again" walk = code[code.index("for (const n of nodesData.nodes)"):] walk = walk[:walk.index("throw (lastErr")] @@ -534,7 +535,7 @@ def test_search_connects_in_one_place(): """Two call sites with their own connect is how one of them kept `nodes[0]`, and how the sweep and the warm-up each negotiated the same group: every connection goes through the pool, and only the pool calls `connectToGroup`.""" - code = _code_only(SEARCH_PAGE.read_text(encoding="utf-8")) + code = _code_only(search_source()) assert code.count("transport.connect(") == 1 # The definition, and the pool's one call. assert code.count("connectToGroup(") == 2 -- cgit v1.2.3