From c5bdd83183bffcd726db3f7b31022c40117c295a Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Wed, 8 Jul 2026 17:05:35 -0400 Subject: [PATCH] test(#34): make my-videos mirror relay-truth test self-contained MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tests/my-videos-mirror-relay-truth.test.mjs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/my-videos-mirror-relay-truth.test.mjs b/tests/my-videos-mirror-relay-truth.test.mjs index 51dc3fee..0e9f34a9 100644 --- a/tests/my-videos-mirror-relay-truth.test.mjs +++ b/tests/my-videos-mirror-relay-truth.test.mjs @@ -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";