diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-08-31 01:06:06 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-08-31 01:06:06 +0200 |
| commit | 0c2754d2d4cb1905d5e324f56fbc64e4afae526f (patch) | |
| tree | c081859830e017af09af9d2f73c6ff8442aacce4 /packages/meshbay-hub/tests/test_transport_contracts.py | |
| parent | f6e80064ff8c4869a6ba2cef908cc54326948463 (diff) | |
| download | meshbay-0c2754d2d4cb1905d5e324f56fbc64e4afae526f.tar.gz | |
refactor(ui): extract Explore, Login, Register and CreateGroup from app.js
ExplorePage → explore-page.js (static import), LoginPage/RegisterPage/
FirstRunPage → auth-page.js (static import, LoginPage receives onLogin
as a prop), CreateGroupPage/wizard → create-group-page.js (lazy-loaded
via dynamic import(), same pattern as AdminPage/NodePage).
app.js goes from 1803 to 914 lines. webapp.py _ASSETS extended with the
three new files and the previously missing extracted pages. Test fixtures
updated to follow the moved components.
Co-Authored-By: Claude Opus 4.6 <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 | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/packages/meshbay-hub/tests/test_transport_contracts.py b/packages/meshbay-hub/tests/test_transport_contracts.py index 6c178a6..6011ddb 100644 --- a/packages/meshbay-hub/tests/test_transport_contracts.py +++ b/packages/meshbay-hub/tests/test_transport_contracts.py @@ -27,11 +27,14 @@ APP = STATIC / "app.js" # effect moved out of app.js in the group-page refactor. CHAT_APP = STATIC / "chat-app.js" GROUP_PAGE = STATIC / "group-page.js" +CREATE_GROUP = STATIC / "create-group-page.js" SPLIT_FILES = [APP, GROUP_PAGE, CHAT_APP, STATIC / "files-app.js", STATIC / "video-player.js", STATIC / "video-app.js", STATIC / "music-app.js", STATIC / "music-player.js", STATIC / "photos-app.js", - STATIC / "group-settings.js"] + STATIC / "group-settings.js", + STATIC / "auth-page.js", STATIC / "explore-page.js", + CREATE_GROUP] pytestmark = pytest.mark.skipif( not TRANSPORT.exists(), reason="the SPA sources are not available") @@ -57,6 +60,11 @@ def group_page(): return GROUP_PAGE.read_text() +@pytest.fixture(scope="module") +def create_group(): + return CREATE_GROUP.read_text() + + def test_chat_history_pages_backwards(transport): body = transport[transport.index("async fetchChatHistory"):] body = body[:body.index("\n }")] @@ -188,7 +196,7 @@ def test_a_refusal_from_the_node_counts_as_present(group_page): # ── The create-group form ───────────────────────────────────────────────────── -def test_the_form_asks_one_question_not_two(app): +def test_the_form_asks_one_question_not_two(create_group): """ Visibility and admission were separate selectors that could only ever be set together, and the form knew it — picking Public reached over and set the @@ -199,7 +207,7 @@ def test_the_form_asks_one_question_not_two(app): So there is one selector. "Open" is what makes a group listed, and the request derives the rest. """ - form = app[app.index("function CreateGroupFormSimple"):] + form = create_group[create_group.index("function CreateGroupFormSimple"):] form = form[:form.index("\n}\n")] assert "setVisibility(" not in form, "the visibility selector is back" @@ -228,8 +236,8 @@ def test_the_strings_the_visibility_box_used_are_gone(app): assert f"'{key}'" not in text, f"{locale.name} still carries {key}" -def test_the_form_starts_on_a_combination_the_api_accepts(app): - form = app[app.index("function CreateGroupFormSimple"):] +def test_the_form_starts_on_a_combination_the_api_accepts(create_group): + form = create_group[create_group.index("function CreateGroupFormSimple"):] assert "useState('invite')" in form[:form.index("return html")] |