diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-25 10:23:05 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-25 10:23:05 +0200 |
| commit | f1ed3e6be452f6211cee8db1afef8b56473a04db (patch) | |
| tree | 27a3f0060e968784f13be54ba074835dcc516eb7 /packages/meshbay-hub/tests/test_transport_contracts.py | |
| parent | 762233772162a05be67432aa551a430b939250de (diff) | |
| download | meshbay-f1ed3e6be452f6211cee8db1afef8b56473a04db.tar.gz | |
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 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/tests/test_transport_contracts.py')
| -rw-r--r-- | packages/meshbay-hub/tests/test_transport_contracts.py | 5 |
1 files changed, 3 insertions, 2 deletions
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 |