Files
frontend/src/entities/bank-card/api/summary.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

36 lines
871 B
TypeScript

import { expect, it } from "vitest";
import { type BankSummary, sortBankSummary } from "./queries";
const money = (value: string) => ({ currency: "RUB", value });
it("orders displayed expenses descending, preserving cents, ties and source data", () => {
const values = [
"-10",
"9007199254740992.01",
"0",
"9007199254740992.02",
"-2",
"0",
];
const data: BankSummary = {
cardId: "a",
categories: values.map((value, index) => ({
categoryId: String(index),
categoryName: String(index),
expenses: money("100"),
net: money(value),
refunds: money("0"),
})),
expenses: money("0"),
month: "2026-09",
net: money("0"),
refunds: money("0"),
};
expect(sortBankSummary(data).categories.map(row => row.categoryId)).toEqual(
["3", "1", "2", "5", "4", "0"],
);
expect(data.categories.map(row => row.net.value)).toEqual(values);
});