| 1 | import { describe, expect, it } from "vitest"; |
| 2 | import { buildDefaultExposeName } from "@/lib/exposeName"; |
| 3 | |
| 4 | // Cross-language parity vectors -- keep in sync with utils/identity_test.go |
| 5 | const exposeNameVectors = [ |
| 6 | { target: "3000", seed: "test_seed", expected: "bubble-cricket-beacon" }, |
| 7 | { target: "", seed: "portal", expected: "zesty-beacon-sketch" }, |
| 8 | { target: "http://localhost:8080", seed: "cli_abc", expected: "sprightly-rocket-zap" }, |
| 9 | { target: "192.168.1.1:8080", seed: "web_xyz", expected: "velvet-yeti-march" }, |
| 10 | { target: "localhost", seed: "cli_", expected: "misty-rocket-ripple" }, |
| 11 | ] as const; |
| 12 | |
| 13 | describe("buildDefaultExposeName", () => { |
| 14 | it.each(exposeNameVectors)( |
| 15 | "generates $expected for target=$target seed=$seed", |
| 16 | ({ target, seed, expected }) => { |
| 17 | expect(buildDefaultExposeName(target, seed)).toBe(expected); |
| 18 | }, |
| 19 | ); |
| 20 | }); |