Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions tests/audit-navigation-auth-regressions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,20 @@ describe("audit navigation and auth regressions", () => {
// The viewport-driven region/tabpanel role is wired through the extracted hook, whose
// media-query subscription carries the guard with it.
expect(clinicalDashboardSource).toContain("useUploadDesktopLayout()");
expect(source("src/components/clinical-dashboard/use-upload-desktop-layout.ts")).toContain(
"subscribeToUploadDesktopLayout",
// Assert the EXPORTED hook's return wires the media-query subscription through
// useSyncExternalStore with the () => false server snapshot, and that the call closes
// right after that snapshot. Scoping to the exported function body (not the whole file)
// plus the `return` anchor and trailing `)` means a stale/disconnected call elsewhere, a
// comment or string, a present-but-unused helper, a dropped SSR fallback, or a mutated
// snapshot such as `() => false || getUploadDesktopLayoutSnapshot()` all fail the guard.
const uploadDesktopHookSource = source("src/components/clinical-dashboard/use-upload-desktop-layout.ts");
const useUploadDesktopLayoutBody = sourceSegment(
uploadDesktopHookSource,
"export function useUploadDesktopLayout(",
"}",
);
expect(useUploadDesktopLayoutBody).toMatch(
/return\s+useSyncExternalStore\(\s*subscribeToUploadDesktopLayout,\s*getUploadDesktopLayoutSnapshot,\s*\(\)\s*=>\s*false\s*\)/,
);
expect(clinicalDashboardSource).toContain('event.key === "ArrowRight"');
expect(clinicalDashboardSource).toContain('event.key === "ArrowLeft"');
Expand Down