TypeScript
fix(web): Limits ChatGPT usage card names the connected accounts (#24940)
Victor Vogel87c33c89908f
diff --git a/apps/web/src/components/usage/UsageLimitsPooled.browser.test.tsx b/apps/web/src/components/usage/UsageLimitsPooled.browser.test.tsxnew file mode 100644index 00000000000..ab114fbbd6f--- /dev/null+++ b/apps/web/src/components/usage/UsageLimitsPooled.browser.test.tsx@@ -0,0 +1,65 @@+import {+ EnvironmentId,+ ProviderDriverKind,+ ProviderInstanceId,+ type ServerProvider,+} from "@t3tools/contracts";+import { CHATGPT_USAGE_URL } from "@t3tools/shared/usageLimits";+import { describe, expect, it } from "vite-plus/test";++import { render } from "../../../test/render";+import { UsageLimitsPooled } from "./UsageLimitsPooled";++const checkedAt = "2026-10-25T16:00:00.000Z";++function managedChatGpt(instanceId: string, displayName: string): ServerProvider {+ return {+ instanceId: ProviderInstanceId.make(instanceId),+ driver: ProviderDriverKind.make("codex"),+ displayName,+ enabled: true,+ installed: true,+ version: "0.164.0",+ status: "ready",+ auth: { status: "authenticated" },+ checkedAt,+ models: [],+ slashCommands: [],+ skills: [],+ usageLimits: {+ checkedAt,+ windows: [],+ unavailable: { reason: "unsupported", message: "Track usage in ChatGPT." },+ externalUsage: { label: "ChatGPT usage", url: CHATGPT_USAGE_URL },+ },+ };+}++describe("UsageLimitsPooled ChatGPT usage card", () => {+ it("names the managed connections it covers", async () => {+ const presentations = new Map([+ [+ EnvironmentId.make("desk"),+ {+ entry: { target: { label: "Desk" } },+ serverConfig: {+ providers: [+ managedChatGpt("chatgpt_work", "ChatGPT Work"),+ managedChatGpt("chatgpt_personal", "ChatGPT Personal"),+ ],+ },+ },+ ],+ ]);+ await using screen = await render(+ <UsageLimitsPooled presentations={presentations} now={Date.parse(checkedAt)} />,+ );++ await expect+ .element(screen.getByText("ChatGPT Work on Desk, ChatGPT Personal on Desk"))+ .toBeVisible();+ await expect+ .element(screen.getByText("View usage in ChatGPT with your connected account."))+ .toBeVisible();+ });+});diff --git a/apps/web/src/components/usage/UsageLimitsPooled.tsx b/apps/web/src/components/usage/UsageLimitsPooled.tsxindex 7157607daba..e55f5d3857f 100644--- a/apps/web/src/components/usage/UsageLimitsPooled.tsx+++ b/apps/web/src/components/usage/UsageLimitsPooled.tsx@@ -660,6 +660,9 @@ export function UsageLimitsPooled({) : null}<div className="min-w-0 space-y-1"><h2 className="text-sm font-medium">{link.label}</h2>+ <p className="text-xs break-words text-muted-foreground">+ {link.accounts.join(", ")}+ </p>{link.url === CHATGPT_USAGE_URL ? (<p className="text-xs text-muted-foreground">View usage in ChatGPT with your connected account.