Files
frontend/src/entities/bank-card/model/period.test.ts
T
ksv741 3eafad2657
Frontend security / security (push) Successful in 9s
Frontend verify / verify (push) Failing after 37m50s
Frontend security / security (pull_request) Successful in 9s
Frontend verify / verify (pull_request) Failing after 42m10s
Conventional commits / commits (pull_request) Successful in 29s
chore: finish frontend ESLint migration #18
Enable every plugin recommended preset and replace Biome with ESLint formatting.

Preserve API contracts and JSX whitespace; verify source, tests, builds and tooling.
2026-09-28 07:31:28 +03:00

27 lines
840 B
TypeScript

import { afterEach, expect, it, vi } from "vitest";
import { bankPeriod } from "./period";
afterEach(() => vi.useRealTimers());
it.each([
["0001-01", "0001-01-01", "0001-01-31"],
["0099-12", "0099-12-01", "0099-12-31"],
["2026-09", "2026-09-01", "2026-09-30"],
["2024-02", "2024-02-01", "2024-02-29"],
["0004-02", "0004-02-01", "0004-02-29"],
])("keeps the ISO year for legacy month %s", (month, from, to) => {
expect(bankPeriod(new URLSearchParams({ month }))).toEqual({ from, to });
});
it("rejects zero year consistently in legacy and explicit periods", () => {
vi.useFakeTimers();
vi.setSystemTime(new Date("2026-09-27T10:00:00Z"));
for (const query of ["month=0000-01", "from=0000-01-01&to=0000-01-31"]) {
expect(bankPeriod(new URLSearchParams(query))).toEqual({
from: "2026-09-01",
to: "2026-09-30",
});
}
});