Frontend verify / commits (pull_request) Successful in 31s
Frontend verify / security (pull_request) Successful in 11s
Frontend verify / verify (pull_request) Successful in 9m1s
Frontend verify / commits (push) Skipped
Frontend verify / security (push) Successful in 10s
Frontend verify / verify (push) Successful in 9m59s
55 lines
1.8 KiB
TypeScript
55 lines
1.8 KiB
TypeScript
import { expect, it } from "vitest";
|
|
|
|
import { bankOperationAppearance } from "./operation-appearance";
|
|
|
|
it.each(["Жильё", " ЖИЛЬЕ "])("normalizes category %s", (name) => {
|
|
expect(bankOperationAppearance("expense", name)).toEqual({
|
|
color: "orange", variant: "home",
|
|
});
|
|
});
|
|
|
|
it.each(["Другое", "Моя категория", "constructor", null, undefined])(
|
|
"uses the fallback for category %s",
|
|
(name) => {
|
|
expect(bankOperationAppearance("expense", name)).toEqual({
|
|
color: "gray", variant: "grid",
|
|
});
|
|
},
|
|
);
|
|
|
|
it.each([
|
|
["topup", "green", "topup"],
|
|
["transfer", "blue", "transfer"],
|
|
["refund", "teal", "refund"],
|
|
] as const)("ignores expense category for %s", (kind, color, variant) => {
|
|
expect(bankOperationAppearance(kind, "Жильё")).toEqual({ color, variant });
|
|
});
|
|
|
|
it.each([
|
|
["Алкоголь", "wine"],
|
|
["Вклады", "deposit"],
|
|
["Жильё", "home"],
|
|
["Здоровье", "medical"],
|
|
["Инвестиции и накопления", "growth"],
|
|
["Кафе", "coffee"],
|
|
["Образование", "education"],
|
|
["Переводы", "transfer"],
|
|
["Погашение кредита", "repayment"],
|
|
["Подписки", "subscriptions"],
|
|
["Покупки", "shopping"],
|
|
["Продукты", "basket"],
|
|
["Путешествия", "travel"],
|
|
["Развлечения", "music"],
|
|
["Связь и интернет", "wifi"],
|
|
["Снятие наличных", "cashWithdrawal"],
|
|
["Ставки", "dice"],
|
|
["Страхование", "shield"],
|
|
["Табак", "smoking"],
|
|
["Такси", "taxi"],
|
|
["Транспорт", "car"],
|
|
["Хостинг и ИИ-сервисы", "server"],
|
|
["Цифровые покупки", "download"],
|
|
])("maps category %s to its icon", (name, variant) => {
|
|
expect(bankOperationAppearance("expense", name).variant).toBe(variant);
|
|
});
|