aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/tests/test_spa_ordering.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/tests/test_spa_ordering.py')
-rw-r--r--packages/meshbay-hub/tests/test_spa_ordering.py22
1 files changed, 17 insertions, 5 deletions
diff --git a/packages/meshbay-hub/tests/test_spa_ordering.py b/packages/meshbay-hub/tests/test_spa_ordering.py
index dfc92f9..d00b9a0 100644
--- a/packages/meshbay-hub/tests/test_spa_ordering.py
+++ b/packages/meshbay-hub/tests/test_spa_ordering.py
@@ -113,14 +113,26 @@ def test_the_ack_still_verifies_the_announced_node_key():
# Users tab referencing `doInvite`, `members` and `adminId` — none of which are
# defined there.
+# The group-page refactor split what used to be one app.js into one file per
+# "application" (chat-app.js, files-app.js, video-player.js) plus
+# group-settings.js and the group shell itself, group-page.js. AdminPage and
+# App() stayed in app.js. `_component` below is told which file to read a
+# given top-level component from.
APP = STATIC / "app.js"
+COMPONENT_FILES = {
+ "GroupSettingsPanel": STATIC / "group-settings.js",
+ "GroupPage": STATIC / "group-page.js",
+ "ChatPanel": STATIC / "chat-app.js",
+ "FilesPanel": STATIC / "files-app.js",
+ "VideoPlayer": STATIC / "video-player.js",
+}
def _component(name: str) -> str:
"""The source of one top-level `function Name(...)`, up to the next one."""
- source = APP.read_text()
+ source = COMPONENT_FILES.get(name, APP).read_text()
start = source.find(f"\nfunction {name}(")
- assert start != -1, f"{name} is gone from app.js — update this test"
+ assert start != -1, f"{name} is gone — update this test"
end = source.find("\nfunction ", start + 1)
return source[start:end if end != -1 else len(source)]
@@ -220,7 +232,7 @@ def test_no_caller_waits_for_one_chunk_at_a_time():
# two ends of that, since neither shows up in any Python test.
def test_leaving_a_group_hands_the_transport_over_rather_than_closing_it():
- app = APP.read_text()
+ app = _component("GroupPage")
cleanup = app[app.index(" return () => {\n cancelled = true;"):]
cleanup = cleanup[:cleanup.index("\n }, [groupId")]
assert "releaseWhenIdle" in cleanup, (
@@ -252,7 +264,7 @@ def test_a_multi_file_download_waits_for_each_picker():
meant the first opened a dialog and the rest were rejected — two files
selected, one file downloaded.
"""
- app = APP.read_text()
+ app = STATIC.joinpath("files-app.js").read_text()
# Anchored on the loop rather than on the markup around it: the toolbar
# moved from a dropdown to icon buttons and took the old wrapper with it,
# while the property under test — one picker at a time — did not change.
@@ -269,7 +281,7 @@ def test_links_in_chat_are_built_as_elements_not_markup():
never HTML, and only for http(s) — otherwise javascript: would be one
message away from running here.
"""
- app = APP.read_text()
+ app = STATIC.joinpath("chat-app.js").read_text()
fn = app[app.index("function linkify("):]
fn = fn[:fn.index("\nfunction ", 1)]
assert "innerHTML" not in fn and "dangerouslySetInnerHTML" not in fn