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); });