fix: localize usage and salary insights
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user