| 1 | import { ProviderDriverKind } from "@t3tools/contracts"; |
| 2 | import { describe, expect, it } from "vite-plus/test"; |
| 3 | |
| 4 | import { resolveProviderInstanceAcpRegistryIconUrl } from "./ProviderInstanceIcon"; |
| 5 | |
| 6 | describe("resolveProviderInstanceAcpRegistryIconUrl", () => { |
| 7 | it("uses allowlisted catalog metadata and rejects untrusted overrides", () => { |
| 8 | expect( |
| 9 | resolveProviderInstanceAcpRegistryIconUrl({ |
| 10 | driverKind: ProviderDriverKind.make("acpRegistry"), |
| 11 | agentId: "kilo", |
| 12 | iconUrl: "https://cdn.agentclientprotocol.com/registry/icons/kilo.svg", |
| 13 | }), |
| 14 | ).toBe("https://cdn.agentclientprotocol.com/registry/icons/kilo.svg"); |
| 15 | expect( |
| 16 | resolveProviderInstanceAcpRegistryIconUrl({ |
| 17 | driverKind: ProviderDriverKind.make("acpRegistry"), |
| 18 | agentId: "generic-agent", |
| 19 | iconUrl: "https://example.com/not-official.svg", |
| 20 | }), |
| 21 | ).toBe("https://cdn.agentclientprotocol.com/registry/v1/latest/generic-agent.svg"); |
| 22 | }); |
| 23 | |
| 24 | it("does not resolve registry icons for other provider drivers", () => { |
| 25 | expect( |
| 26 | resolveProviderInstanceAcpRegistryIconUrl({ |
| 27 | driverKind: ProviderDriverKind.make("codex"), |
| 28 | agentId: "kilo", |
| 29 | }), |
| 30 | ).toBeNull(); |
| 31 | }); |
| 32 | }); |