diff --git a/src/app/routes/AppRoutes/AllAccounts.test.tsx b/src/app/routes/AppRoutes/AllAccounts.test.tsx index 88676eb..a189416 100644 --- a/src/app/routes/AppRoutes/AllAccounts.test.tsx +++ b/src/app/routes/AppRoutes/AllAccounts.test.tsx @@ -11,7 +11,7 @@ import { } from "@testing-library/react"; import { http, HttpResponse } from "msw"; import { MemoryRouter, useLocation } from "react-router"; -import { beforeEach, describe, expect, it } from "vitest"; +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import type { BrokerageOperation } from "@/entities/broker-operation"; import type { IncomeAnalytics } from "@/entities/income"; @@ -145,6 +145,7 @@ function renderPage(path: string) { return client; } +afterEach(() => vi.useRealTimers()); beforeEach(() => { server.use( http.post("*/api/v1/auth/refresh", () => @@ -271,6 +272,8 @@ describe("All accounts routes", () => { ); it("restores applied dates when switching accounts in events", async () => { + vi.useFakeTimers({ toFake: ["Date"] }); + vi.setSystemTime(new Date("2026-10-15T12:00:00Z")); // The events calendar blocks past dates, so pick within selectable dates. const search = `?from=${defaultPeriod()[0]}&to=${defaultPeriod()[1]}`; renderPage(`/accounts/all/events${search}`);