The best way to control Claude Code, Codex and more from any computer or phone
| 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 | }); |