aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/tests/spa_source.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-09-25 10:23:05 +0200
committerChristophe Besson <cbesson@gmail.com>2026-09-25 10:23:05 +0200
commitf1ed3e6be452f6211cee8db1afef8b56473a04db (patch)
tree27a3f0060e968784f13be54ba074835dcc516eb7 /packages/meshbay-hub/tests/spa_source.py
parent762233772162a05be67432aa551a430b939250de (diff)
downloadmeshbay-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/spa_source.py')
-rw-r--r--packages/meshbay-hub/tests/spa_source.py28
1 files changed, 28 insertions, 0 deletions
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())