From fead7c18af1316fd7448fce73b293d178cce956d Mon Sep 17 00:00:00 2001 From: Sergey Krylov Date: Fri, 23 Oct 2026 08:16:22 +0300 Subject: [PATCH] test: pin date in account events date filter test (WealthLedger/frontend#98) The test clicked today + 10 days, which falls outside the Mantine calendar grid for some real dates and made the suite fail depending on the run date. --- .../AccountEventsPage/AccountEventsPage.filters.test.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pages/account-events/ui/AccountEventsPage/AccountEventsPage.filters.test.tsx b/src/pages/account-events/ui/AccountEventsPage/AccountEventsPage.filters.test.tsx index 8bb0142..7a135aa 100644 --- a/src/pages/account-events/ui/AccountEventsPage/AccountEventsPage.filters.test.tsx +++ b/src/pages/account-events/ui/AccountEventsPage/AccountEventsPage.filters.test.tsx @@ -17,7 +17,7 @@ import { useLocation, useNavigate, } from "react-router"; -import { beforeEach, describe, expect, it, vi } from "vitest"; +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { configureAuthClient } from "@/shared/api"; import { defaultPeriod, formatDate, moscowDate } from "@/shared/lib"; @@ -73,6 +73,10 @@ function renderEvents(accountId: string, searches: string[]) { describe("Upcoming event date filters", () => { beforeEach(() => { + // Pin "today": the test picks today + 10 days, which must be inside the visible calendar grid. + // Real dates can push it beyond the grid (e.g. 2026-10-23 -> 2 November). + vi.useFakeTimers({ toFake: ["Date"] }); + vi.setSystemTime(new Date("2026-08-10T09:00:00Z")); configureAuthClient({ accessToken: () => "token", clear: vi.fn(), @@ -80,6 +84,8 @@ describe("Upcoming event date filters", () => { }); }); + afterEach(() => vi.useRealTimers()); + it("keeps reads and sync disabled without an account scope", async () => { const requests: string[] = []; server.use(