aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/tests/test_search_unreachable_note.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-10-05 13:13:54 +0200
committerChristophe Besson <cbesson@gmail.com>2026-10-05 13:13:54 +0200
commit92b7afcb186d7aaf475939d58a0385f408425eeb (patch)
treea0283cdda0e91cf1af2a1ff7b1a0a896d3a4d1f4 /packages/meshbay-hub/tests/test_search_unreachable_note.py
parent97fa4cf78a826050b9d1df0b484a7794861cda80 (diff)
downloadmeshbay-main.tar.gz
feat(hub): say "N groups unreachable" on Search for a few seconds, not for goodHEAD0.18main
The line sat above the results for as long as the page was open. It is now said once a cross-group pass is over, for five seconds, in the same passing note as "Link copied" — moved out of copy-link.js into note.js (`say(text, ms)`), one note at a time for the whole page. The `.search-unreachable` rule goes with the line it styled. The copy-link probe now also checks in Chrome that the note goes by itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/tests/test_search_unreachable_note.py')
-rw-r--r--packages/meshbay-hub/tests/test_search_unreachable_note.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/packages/meshbay-hub/tests/test_search_unreachable_note.py b/packages/meshbay-hub/tests/test_search_unreachable_note.py
new file mode 100644
index 0000000..41ed25c
--- /dev/null
+++ b/packages/meshbay-hub/tests/test_search_unreachable_note.py
@@ -0,0 +1,33 @@
+"""
+"N groups unreachable" on the cross-group Search page is said once a pass is
+over, for a few seconds, in the same passing note as "Link copied" (note.js) —
+not left above the results for as long as the page is open.
+
+Source-level, as the other Search wiring checks are: what is held is where the
+line is said and that nothing renders it in the page any more.
+"""
+
+import re
+from pathlib import Path
+
+STATIC = Path(__file__).resolve().parents[1] / "src" / "meshbay_hub" / "static"
+
+
+def test_said_once_the_pass_is_over_and_not_rendered():
+ source = (STATIC / "search-page.js").read_text(encoding="utf-8")
+ assert "import { say } from './note.js';" in source
+ after = source[source.index("const { unreachable } = await fetchAllIndexes("):]
+ after = after[:after.index("})();")]
+ assert re.search(r"if \(cancelled\) return;\s*setFetching\(false\);", after)
+ assert "say(t('search.unreachable', { n: unreachable.length }), UNREACHABLE_NOTE_MS)" in after
+ assert "search-unreachable" not in source
+ ms = int(re.search(r"const UNREACHABLE_NOTE_MS = (\d+);", source).group(1))
+ assert 2000 <= ms <= 8000
+
+
+def test_one_note_for_the_whole_page():
+ note = (STATIC / "note.js").read_text(encoding="utf-8")
+ assert "export function say(text, ms = 2500)" in note
+ assert "clearTimeout(_timer)" in note
+ copy = (STATIC / "copy-link.js").read_text(encoding="utf-8")
+ assert "import { say } from './note.js';" in copy and "_say" not in copy