test: pin date in account events date filter test (WealthLedger/frontend#98)
Frontend verify / commits (pull_request) Successful in 47s
Frontend verify / security (pull_request) Failing after 23s
Frontend verify / verify (pull_request) Skipped
Frontend verify / commits (pull_request) Successful in 1m0s

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.
This commit is contained in:
2026-10-23 08:16:22 +03:00
parent ed811e88fa
commit fead7c18af
@@ -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(