From 0ec2cb4105e2a138558eab134aa499f8d7d27c05 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 15 Oct 2026 17:17:56 +0000 Subject: [PATCH] test: pin the Earlier alerts clock to Perth midday The file used the real clock, so alerts made a few minutes ago landed under Yesterday in the first minutes after Perth midnight and two tests failed. Faking only Date keeps timers real for waitFor. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01KhogQUCHgdtFBHFtpjnd1n --- tests/work-screens-my-day-earlier-alerts.dom.test.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/work-screens-my-day-earlier-alerts.dom.test.tsx b/tests/work-screens-my-day-earlier-alerts.dom.test.tsx index b3588171e1..2ca5f43f37 100644 --- a/tests/work-screens-my-day-earlier-alerts.dom.test.tsx +++ b/tests/work-screens-my-day-earlier-alerts.dom.test.tsx @@ -89,6 +89,10 @@ function renderPage() { } beforeEach(() => { + // Pin the clock to midday in Perth, so alerts made "minutes ago" stay under Today. + // On the real clock this file failed in the first minutes after Perth midnight. + vi.useFakeTimers({ toFake: ["Date"] }); + vi.setSystemTime(new Date("2026-10-15T04:00:00.000Z")); window.localStorage.clear(); resetExampleDataForTests(); worker.shown = []; @@ -108,6 +112,7 @@ beforeEach(() => { afterEach(() => { vi.restoreAllMocks(); + vi.useRealTimers(); cleanup(); window.localStorage.clear(); });