mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
test(#34): make my-videos mirror relay-truth test self-contained
The mirror flag helpers (nip71MirrorFlags) read the global `localStorage`, but this test file only wired `globalThis.document` from JSDOM — never `localStorage`. It therefore passed only when run inside the full suite, relying on another test file leaking the localStorage shim into the shared global. Run in isolation it failed 4/4 (isMirrorEnabled always returned false → "Share to apps" instead of "Shared ✓"). Import the existing setup-localstorage shim so the file is honest in isolation. No assertions changed — the product code (#34 relay-truth detection) was already correct; this only removes a load-order dependency. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
5844a36a54
commit
c5bdd83183
1 file changed
+5
@@ -9,6 +9,11 @@
|
||||
// - refreshMirrorStates() looks up relay truth (batched), corrects the button
|
||||
// label, AND reconciles the local flag so it becomes a correct cache.
|
||||
|
||||
// Self-contained localStorage shim: the mirror flag helpers read the global
|
||||
// `localStorage`, so without this the suite only passed by relying on another
|
||||
// test file leaking the shim into the shared global (brittle load-order
|
||||
// dependency). Importing it here makes this file honest in isolation.
|
||||
import "./test-helpers/setup-localstorage.mjs";
|
||||
import test, { beforeEach, afterEach } from "node:test";
|
||||
import { strict as assert } from "node:assert";
|
||||
import { JSDOM } from "jsdom";
|
||||
|
||||
Reference in new issue
Block a user