import { describe, expect, test } from "vitest"; import { hostForServiceDid, serviceDidForHost } from "$lib/auth/agent"; describe("serviceDidForHost", () => { test.each([ ["migrator.tngl.boltless.dev", "did:web:migrator.tngl.boltless.dev"], ["https://migrator.tngl.boltless.dev/", "did:web:migrator.tngl.boltless.dev"], ["http://knot.oyster.cafe:8443", "did:web:knot.oyster.cafe%3A8443"] ])("maps %s to %s", (input, expected) => { expect(serviceDidForHost(input)).toBe(expected); }); test("round-trips with hostForServiceDid", () => { const host = "migrator.tngl.boltless.dev"; expect(hostForServiceDid(serviceDidForHost(host))).toBe(host); }); });