The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { describe, expect, it, vi } from "vite-plus/test"; |
| 2 | |
| 3 | import { modelChipIcon } from "./contextChipIconSource"; |
| 4 | |
| 5 | vi.mock("./contextChipIcons.generated", () => ({ |
| 6 | CONTEXT_CHIP_ICON_SOURCES: { bot: "bot.png" }, |
| 7 | PROVIDER_CHIP_ICONS: { codex: { source: "codex.png", tintsIcon: true } }, |
| 8 | })); |
| 9 | vi.mock("./markdownFileIcons", () => ({ |
| 10 | markdownFileIconSource: vi.fn(), |
| 11 | markdownIconAssetUri: vi.fn(), |
| 12 | })); |
| 13 | |
| 14 | describe("modelChipIcon", () => { |
| 15 | it("prefers a provider's own image, then its logo, then a generic glyph", () => { |
| 16 | expect(modelChipIcon({ driver: "codex", iconUrl: "https://x.test/icon.png" })).toEqual({ |
| 17 | source: { uri: "https://x.test/icon.png" }, |
| 18 | tintsIcon: false, |
| 19 | }); |
| 20 | expect(modelChipIcon({ driver: "codex" })).toEqual({ source: "codex.png", tintsIcon: true }); |
| 21 | expect(modelChipIcon({ driver: "unknown" })).toEqual({ source: "bot.png", tintsIcon: true }); |
| 22 | }); |
| 23 | |
| 24 | it("never hands a native chip an SVG it cannot decode", () => { |
| 25 | for (const iconUrl of [ |
| 26 | "https://cdn.agentclientprotocol.com/registry/v1/latest/devin.svg", |
| 27 | "https://x.test/icon.SVG?v=2", |
| 28 | ]) { |
| 29 | expect(modelChipIcon({ driver: "acpRegistry", iconUrl })).toEqual({ |
| 30 | source: "bot.png", |
| 31 | tintsIcon: true, |
| 32 | }); |
| 33 | } |
| 34 | expect(modelChipIcon({ driver: "codex", iconUrl: "https://x.test/icon.svg" })).toEqual({ |
| 35 | source: "codex.png", |
| 36 | tintsIcon: true, |
| 37 | }); |
| 38 | }); |
| 39 | }); |