The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { describe, expect, it } from "vite-plus/test"; |
| 2 | |
| 3 | import { deriveAvailableInstanceId } from "./providerInstanceIds.ts"; |
| 4 | |
| 5 | describe("deriveAvailableInstanceId", () => { |
| 6 | it("derives a collision-free instance id without exceeding the slug limit", () => { |
| 7 | const derive = (label: string) => `acpRegistry_${label}`; |
| 8 | const existing = new Set(["acpRegistry_gemini", "acpRegistry_gemini_2"]); |
| 9 | |
| 10 | expect(deriveAvailableInstanceId(derive, "gemini", existing)).toBe("acpRegistry_gemini_3"); |
| 11 | |
| 12 | const longBase = `acpRegistry_${"a".repeat(48)}`; |
| 13 | expect(deriveAvailableInstanceId(() => longBase, "ignored", new Set([longBase]))).toHaveLength( |
| 14 | 62, |
| 15 | ); |
| 16 | }); |
| 17 | }); |