Skip to content

Commit 87c33c8

Browse files
only21milclaude
andauthored
fix(web): Limits ChatGPT usage card names the connected accounts (#24940)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 22c7039 commit 87c33c8

2 files changed

Lines changed: 68 additions & 0 deletions

File tree

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import {
2+
EnvironmentId,
3+
ProviderDriverKind,
4+
ProviderInstanceId,
5+
type ServerProvider,
6+
} from "@t3tools/contracts";
7+
import { CHATGPT_USAGE_URL } from "@t3tools/shared/usageLimits";
8+
import { describe, expect, it } from "vite-plus/test";
9+
10+
import { render } from "../../../test/render";
11+
import { UsageLimitsPooled } from "./UsageLimitsPooled";
12+
13+
const checkedAt = "2026-10-25T16:00:00.000Z";
14+
15+
function managedChatGpt(instanceId: string, displayName: string): ServerProvider {
16+
return {
17+
instanceId: ProviderInstanceId.make(instanceId),
18+
driver: ProviderDriverKind.make("codex"),
19+
displayName,
20+
enabled: true,
21+
installed: true,
22+
version: "0.164.0",
23+
status: "ready",
24+
auth: { status: "authenticated" },
25+
checkedAt,
26+
models: [],
27+
slashCommands: [],
28+
skills: [],
29+
usageLimits: {
30+
checkedAt,
31+
windows: [],
32+
unavailable: { reason: "unsupported", message: "Track usage in ChatGPT." },
33+
externalUsage: { label: "ChatGPT usage", url: CHATGPT_USAGE_URL },
34+
},
35+
};
36+
}
37+
38+
describe("UsageLimitsPooled ChatGPT usage card", () => {
39+
it("names the managed connections it covers", async () => {
40+
const presentations = new Map([
41+
[
42+
EnvironmentId.make("desk"),
43+
{
44+
entry: { target: { label: "Desk" } },
45+
serverConfig: {
46+
providers: [
47+
managedChatGpt("chatgpt_work", "ChatGPT Work"),
48+
managedChatGpt("chatgpt_personal", "ChatGPT Personal"),
49+
],
50+
},
51+
},
52+
],
53+
]);
54+
await using screen = await render(
55+
<UsageLimitsPooled presentations={presentations} now={Date.parse(checkedAt)} />,
56+
);
57+
58+
await expect
59+
.element(screen.getByText("ChatGPT Work on Desk, ChatGPT Personal on Desk"))
60+
.toBeVisible();
61+
await expect
62+
.element(screen.getByText("View usage in ChatGPT with your connected account."))
63+
.toBeVisible();
64+
});
65+
});

‎apps/web/src/components/usage/UsageLimitsPooled.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,9 @@ export function UsageLimitsPooled({
660660
) : null}
661661
<div className="min-w-0 space-y-1">
662662
<h2 className="text-sm font-medium">{link.label}</h2>
663+
<p className="text-xs break-words text-muted-foreground">
664+
{link.accounts.join(", ")}
665+
</p>
663666
{link.url === CHATGPT_USAGE_URL ? (
664667
<p className="text-xs text-muted-foreground">
665668
View usage in ChatGPT with your connected account.

0 commit comments

Comments
 (0)