import { describe, expect, it } from "vitest"; import { buildLegalSyntheticPost, legalPathForSlug, } from "../../lib/legalSyntheticPost"; describe("legalSyntheticPost", () => { it("maps slugs to public paths", () => { expect(legalPathForSlug("privacy")).toBe("/privacy"); expect(legalPathForSlug("terms")).toBe("/terms"); expect(legalPathForSlug("cookies")).toBe("/cookies"); }); it("builds a guide-shaped post from page messages", () => { const post = buildLegalSyntheticPost("privacy", { banner: { title: "Privacy Policy", description: "How we handle information.", author: "Media Economies Design Lab", date: "2026-08-15", }, updated: "Last updated August 15, 2026.", intro: ["Hello."], sections: [{ heading: "What we collect", paragraphs: ["Email."] }], }); expect(post.slug).toBe("__legal__:privacy"); expect(post.frontmatter.title).toBe("Privacy Policy"); expect(post.filePath).toBe("messages/en/pages/privacy.json"); }); });