Files
paseo/packages/app/src/usage/copy.test.ts
T
Mohamed Boudra 05e94ab52e Keep usage logins visible and explain unavailable quota (#5876)
* fix(usage): keep existing logins visible and explain unavailable quota

Credential discovery must preserve accounts whose login exists even when it has expired. Keep vendor failures on the discovered account and isolate discovery failures without inventing provider cards.

* test(usage): align credential route tests with account discovery
2026-10-02 00:30:11 +01:00

19 lines
774 B
TypeScript

import { expect, test } from "vitest";
import { usageCopy } from "./copy";
test.each([
[
{ kind: "expired", expiresAt: "2026-10-01T09:00:00Z", refreshedBy: "claude" },
"Login expired 3h ago. Run claude to refresh it.",
],
[{ kind: "expired", expiresAt: "2026-10-01T09:00:00Z" }, "Login expired 3h ago. Sign in again."],
[
{ kind: "rejected", status: 403, refreshedBy: "codex" },
"Login rejected (HTTP 403). Run codex to refresh it.",
],
[{ kind: "rejected", status: 401 }, "Login rejected (HTTP 401). Sign in again."],
[{ kind: "no_quota", detail: "No active coding plan" }, "No active coding plan"],
] as const)("problem %j", (problem, sentence) => {
expect(usageCopy.problem(problem, new Date("2026-10-01T12:00:00Z"))).toBe(sentence);
});