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