import { describe, it } from "vitest"; import { assertProperty, fc } from "../../../test/property.ts"; import { parseLlmsLinks } from "../map.ts"; const baseUrl = fc.constantFrom( "https://example.com/", "https://host.test/docs/", "http://a.b.c/x/y/", ); describe("parseLlmsLinks (property)", () => { it("only ever yields well-formed absolute URLs, for any input text", () => { assertProperty( import.meta.url, "parseLlmsLinks yields absolute URLs", fc.property(fc.string(), baseUrl, (text, base) => { const links = parseLlmsLinks(text, base); return links.every((link) => { try { const url = new URL(link); // Absolute + idempotent normalization: re-serializing is stable. return url.protocol.length > 0 && new URL(link).toString() === link; } catch { return false; } }); }), ); }); });