refactor: simplify frontend state and mutation boundaries
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
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
This commit was merged in pull request #44.
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
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);
|
||||
});
|
||||
Reference in New Issue
Block a user