diff options
Diffstat (limited to 'packages/meshbay-hub/tests/test_node_page_pairing.py')
| -rw-r--r-- | packages/meshbay-hub/tests/test_node_page_pairing.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/meshbay-hub/tests/test_node_page_pairing.py b/packages/meshbay-hub/tests/test_node_page_pairing.py index 435488e..c716e0a 100644 --- a/packages/meshbay-hub/tests/test_node_page_pairing.py +++ b/packages/meshbay-hub/tests/test_node_page_pairing.py @@ -46,3 +46,23 @@ def test_the_banner_needs_an_explicit_false(): "the pairing banner must not show for a node that has not read its roster") assert "useState(null)" in src.split("const [operatorPaired", 1)[1].split("\n", 1)[0] assert "setOperatorPaired(!!" not in src + + +def test_pair_this_browser_queues_the_code_instead_of_claiming_success(): + """It stored the code where nothing read it, said "Paired successfully", + and the banner came back on the next refresh. The code is redeemed over + MNP by the next group of this node to open, as the wizard's is.""" + src = _source() + pair = src.split("const doPairOperator = useCallback(", 1)[1].split("}, [refresh]);", 1)[0] + assert "session.pendingJoinCode = result.code;" in pair + assert "setOperatorPaired(true)" not in pair + assert "import { HUB, session } from './hub-client.js';" in src + + +def test_no_pairing_banner_for_a_node_with_no_group_yet(): + """A node set up at sign-in hosts nothing yet: there is nothing to pair + for until a group exists, and creating one pairs.""" + src = _source() + banner = src.index('class="node-pair-banner"') + guard = src.rindex("${", 0, banner) + assert "nodeGroups.length > 0" in src[guard:banner] |