feat(plans): publish honest Free and Pro
CI and Deploy / test (pull_request) Successful in 5m6s
CI and Deploy / deploy (pull_request) Has been skipped

This commit is contained in:
cesnimda
2026-08-15 18:04:18 +02:00
parent a7c25499bb
commit a25c31b93a
26 changed files with 403 additions and 93 deletions
+21
View File
@@ -16,10 +16,13 @@ jest.mock("./i18n/I18nProvider", () => ({ useI18n: () => ({ t: (key: string, par
settingsUsageReset: "AI limits reset at the start of each calendar month.",
settingsUsageNoAi: "The Free plan includes core job tracking without AI. Upgrade to Pro to use AI features.",
settingsBillingUpgrade: "Upgrade to Pro",
settingsBillingNotConfigured: "Pro upgrades are not available in this deployment yet.",
};
return Object.entries(params ?? {}).reduce((text, [name, value]) => text.replace(`{${name}}`, String(value)), messages[key] ?? key);
} }) }));
beforeEach(() => jest.clearAllMocks());
test("shows monthly AI call and token limits", async () => {
(api.get as jest.Mock).mockImplementation((url: string) => Promise.resolve({
data: url === "/billing/status" ? { enabled: true, canCheckout: true, canManage: false } : {
@@ -39,3 +42,21 @@ test("shows monthly AI call and token limits", async () => {
expect(screen.queryByLabelText("Monthly AI generations used")).not.toBeInTheDocument();
expect(screen.getByRole("button", { name: "Upgrade to Pro" })).toBeInTheDocument();
});
test("does not offer a false upgrade action when billing is not configured", async () => {
(api.get as jest.Mock).mockImplementation((url: string) => Promise.resolve({
data: url === "/billing/status" ? { enabled: false, canCheckout: false, canManage: false } : {
currentMonth: { calls: 0, estimatedTokens: 0 },
plan: "free",
monthlyCallLimit: 0,
monthlyTokenLimit: 0,
storageUsedBytes: 0,
storageLimitBytes: 250000000,
},
}));
render(<AiUsageCard />);
expect(await screen.findByText(/not available in this deployment yet/i)).toBeInTheDocument();
expect(screen.queryByRole("button", { name: "Upgrade to Pro" })).not.toBeInTheDocument();
});