feat/Update_Controllers_to_Allow_for_Premium_Membership
This commit is contained in:
@@ -14,7 +14,8 @@ jest.mock("./i18n/I18nProvider", () => ({ useI18n: () => ({ t: (key: string, par
|
||||
settingsUsageTokens: "{used} of {limit} estimated tokens",
|
||||
settingsUsageStorage: "{used} of {limit} attachment storage",
|
||||
settingsUsageReset: "AI limits reset at the start of each calendar month.",
|
||||
settingsBillingUpgrade: "Upgrade to Premium",
|
||||
settingsUsageNoAi: "The Free plan includes core job tracking without AI. Upgrade to Pro to use AI features.",
|
||||
settingsBillingUpgrade: "Upgrade to Pro",
|
||||
};
|
||||
return Object.entries(params ?? {}).reduce((text, [name, value]) => text.replace(`{${name}}`, String(value)), messages[key] ?? key);
|
||||
} }) }));
|
||||
@@ -24,8 +25,8 @@ test("shows monthly AI call and token limits", async () => {
|
||||
data: url === "/billing/status" ? { enabled: true, canCheckout: true, canManage: false } : {
|
||||
currentMonth: { calls: 4, estimatedTokens: 12000 },
|
||||
plan: "free",
|
||||
monthlyCallLimit: 25,
|
||||
monthlyTokenLimit: 100000,
|
||||
monthlyCallLimit: 0,
|
||||
monthlyTokenLimit: 0,
|
||||
storageUsedBytes: 50000000,
|
||||
storageLimitBytes: 250000000,
|
||||
},
|
||||
@@ -33,9 +34,8 @@ test("shows monthly AI call and token limits", async () => {
|
||||
|
||||
render(<AiUsageCard />);
|
||||
|
||||
expect(await screen.findByText("4 of 25 generations this month")).toBeInTheDocument();
|
||||
expect(screen.getByText("12,000 of 100,000 estimated tokens")).toBeInTheDocument();
|
||||
expect(await screen.findByText(/Free plan includes core job tracking/)).toBeInTheDocument();
|
||||
expect(screen.getByText("50.0 MB of 250.0 MB attachment storage")).toBeInTheDocument();
|
||||
expect(screen.getByLabelText("Monthly AI generations used")).toHaveAttribute("aria-valuenow", "16");
|
||||
expect(screen.getByRole("button", { name: "Upgrade to Premium" })).toBeInTheDocument();
|
||||
expect(screen.queryByLabelText("Monthly AI generations used")).not.toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "Upgrade to Pro" })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user