From 878a1b7d94398987d3bdd1eb2ac8bcb9eb514825 Mon Sep 17 00:00:00 2001 From: dev_agent Date: Fri, 9 Oct 2026 09:34:37 -0400 Subject: [PATCH] Keep the fake clock across a reload in the offline queue tests vi.clearAllTimers() resets the fake clock to the real time the fake timers were installed at, discarding vi.setSystemTime. reload() called it, so the page opened after a reload read the real date: once the real time passed the household's plan_draft time (Friday 09:00 New York), defaultWeek chose next week (2026-10-12), which the tests have no Supply run for. Restore the clock after clearing the timers. Task: 880e924e-c248-472f-8e92-1baec5b4cc9f Co-Authored-By: Claude Opus 5.5 --- web/src/shopping/offlineQueue.test.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/src/shopping/offlineQueue.test.tsx b/web/src/shopping/offlineQueue.test.tsx index 1ab93fc..b398645 100644 --- a/web/src/shopping/offlineQueue.test.tsx +++ b/web/src/shopping/offlineQueue.test.tsx @@ -201,10 +201,15 @@ async function openPage() { } // reload ends the page open and its timers, as a reload does: a toggle it -// was waiting to try again is never tried, by it, again. +// was waiting to try again is never tried, by it, again. The clock reads on +// as it did: clearAllTimers also puts it back to the real time the fake +// timers were installed at, which would open the new page on whatever week +// the real date falls in. function reload(page: { unmount: () => void }) { page.unmount() + const now = Date.now() vi.clearAllTimers() + vi.setSystemTime(now) } async function advance(ms: number) {