fix: localize usage and salary insights
CI and Deploy / test (push) Successful in 2m40s
CI and Deploy / deploy (push) Successful in 56s

This commit is contained in:
cesnimda
2026-07-31 00:17:33 +02:00
parent 235d22c059
commit 6ed56fd493
5 changed files with 49 additions and 13 deletions
+12
View File
@@ -5,6 +5,18 @@ import AiUsageCard from "./components/AiUsageCard";
import { api } from "./api";
jest.mock("./api", () => ({ api: { get: jest.fn() } }));
jest.mock("./i18n/I18nProvider", () => ({ useI18n: () => ({ t: (key: string, params?: Record<string, unknown>) => {
const messages: Record<string, string> = {
settingsUsageTitle: "Account usage",
settingsUsageUnavailable: "Account usage is temporarily unavailable.",
settingsUsagePlan: "{plan} plan",
settingsUsageGenerations: "{used} of {limit} generations this month",
settingsUsageTokens: "{used} of {limit} estimated tokens",
settingsUsageStorage: "{used} of {limit} attachment storage",
settingsUsageReset: "AI limits reset at the start of each calendar month.",
};
return Object.entries(params ?? {}).reduce((text, [name, value]) => text.replace(`{${name}}`, String(value)), messages[key] ?? key);
} }) }));
test("shows monthly AI call and token limits", async () => {
(api.get as jest.Mock).mockResolvedValue({