| 1 | import * as Schema from "effect/Schema"; |
| 2 | import { describe, expect, it } from "vite-plus/test"; |
| 3 | |
| 4 | import { ClientActivityClientId } from "./background.ts"; |
| 5 | |
| 6 | const decodeClientActivityClientId = Schema.decodeUnknownSync(ClientActivityClientId); |
| 7 | |
| 8 | describe("ClientActivityClientId", () => { |
| 9 | it("trims and accepts bounded client identifiers", () => { |
| 10 | expect(decodeClientActivityClientId(" client-1 ")).toBe("client-1"); |
| 11 | expect(decodeClientActivityClientId("x".repeat(128))).toBe("x".repeat(128)); |
| 12 | }); |
| 13 | |
| 14 | it("rejects empty and oversized client identifiers", () => { |
| 15 | expect(() => decodeClientActivityClientId(" ")).toThrow(); |
| 16 | expect(() => decodeClientActivityClientId("x".repeat(129))).toThrow(); |
| 17 | }); |
| 18 | }); |