// The global Shift+W wiring, pinned at its call site. // // What this is: a source contract, the same idiom as uiBoundary.contract.test.ts โ€” a structural rule // asserted directly rather than left to prose. What it is NOT: a behaviour test. The behaviour lives // in history.dom.test.ts and history.burial.dom.test.ts, which drive `navigateOverOverlays` against // real overlay entries; the end-to-end gesture (Shift+W over an open player, then Back) is a browser // check, because jsdom reproduces history ordering only as bookkeeping. // // It exists because the composition line itself was unpinned: App.tsx is the one module no test // renders (main.tsx lazy-imports it and nothing else does), globalKeymap.dom.test.tsx drives the // hook with its OWN handler, and history.dom.test.ts drives the helper with its own navigate โ€” so // dropping `navigateOverOverlays` from App left all 818 tests green while the user-visible bug came // straight back (round 2, verified by running that revert). import { readFileSync } from "node:fs"; import { fileURLToPath } from "node:url"; import { describe, expect, it } from "vitest"; const APP = readFileSync(fileURLToPath(new URL("./App.tsx", import.meta.url)), "utf8"); describe("App ยท global keymap wiring", () => { it("routes the global home shortcut through navigateOverOverlays", () => { const call = /useGlobalKeymap\(([\s\S]*?)\);/.exec(APP)?.[1]; // A rename or a move is a legitimate change โ€” but then this test is the thing that has to be // updated deliberately, which is the whole point of pinning it. expect( call, "App.tsx no longer calls useGlobalKeymap in a shape this test can read", ).toBeTypeOf("string"); expect(call).toContain("navigateOverOverlays"); expect(call).toContain('setPage("home")'); }); });