From 80b2c9e93868652f22a9f50d3a5e78519a3c5aec Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 14 Oct 2026 03:30:34 +0000 Subject: [PATCH] test(roster): pin the clock in the give-away test so it stops expiring The give-away sheet reads the real clock, and the fixture shift (Thu 15 Oct, 09:00 Perth) counts as urgent inside 24 hours, which swaps "Offer to 1 person" for "I can't make it". The test passed only while the real date was more than a day before the shift. From 09:00 Perth on 14 Oct 2026 it failed on every run, turning Unit coverage red on main and on every PR. Date is now pinned to two days before the shift for that one test. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_015r3N1AdnrkQEPgiP4DuJdN --- tests/roster-team-calendar-manager.dom.test.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/roster-team-calendar-manager.dom.test.tsx b/tests/roster-team-calendar-manager.dom.test.tsx index 6262246bcf..c38ac22730 100644 --- a/tests/roster-team-calendar-manager.dom.test.tsx +++ b/tests/roster-team-calendar-manager.dom.test.tsx @@ -297,6 +297,12 @@ describe("Team calendar, manager layer", () => { }); it("reads requests, manage and the roster again after a give-away is sent from the calendar", async () => { + // The give-away sheet reads the real clock (`useRosterNow()` is not handed the page's pinned + // `now`), and the shift (Thu 15 Oct, 09:00 Perth) counts as urgent inside 24 hours, which swaps + // "Offer to 1 person" for "I can't make it". This test only ever passed because the real date + // was more than a day before the fixture shift; from 09:00 Perth on 14 Oct 2026 it failed on + // every run. Pin Date to two days before the shift so the ordinary give-away path is the one tested. + vi.useFakeTimers({ toFake: ["Date"], now: new Date("2026-10-13T00:00:00Z") }); const { posts, reads } = mockFetch(); render(); fireEvent.click(await screen.findByRole("button", { name: /You, Day 09:00–17:00/ }));