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/spa_source.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 packages/meshbay-hub/tests/spa_source.py (limited to 'packages/meshbay-hub/tests/spa_source.py') diff --git a/packages/meshbay-hub/tests/spa_source.py b/packages/meshbay-hub/tests/spa_source.py new file mode 100644 index 0000000..7df98ca --- /dev/null +++ b/packages/meshbay-hub/tests/spa_source.py @@ -0,0 +1,28 @@ +""" +The web client's source, for the hub tests that read it as text. + +A test that lifts a function out of a file by name stops finding it the day +the function moves to another file — or, for an absence, goes on passing +without looking at it. So the tests that read the search code take it from +here, the page and whatever it has been split into. +""" + +from pathlib import Path + +STATIC = Path(__file__).resolve().parents[1] / "src" / "meshbay_hub" / "static" + + +def search_files() -> list[Path]: + """The search page, and the connection pool once it is a module of its own.""" + return [p for p in (STATIC / "search-page.js", STATIC / "connection-pool.js") + if p.exists()] + + +def search_source() -> str: + return "\n".join(p.read_text(encoding="utf-8") for p in search_files()) + + +def search_argv() -> str: + """The same files, as the one argument the Node harnesses take.""" + import os + return os.pathsep.join(str(p) for p in search_files()) -- cgit v1.2.3