diff options
Diffstat (limited to 'packages/meshbay-hub/tests/spa_source.py')
| -rw-r--r-- | packages/meshbay-hub/tests/spa_source.py | 28 |
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()) |