import { readFile } from "node:fs/promises"; import test from "node:test"; import assert from "node:assert/strict"; const sourcePaths = [ new URL("../src/components/landing-hero-section.tsx", import.meta.url), new URL("../src/components/landing/services-section.tsx", import.meta.url), new URL("../src/components/landing/deliverables-section.tsx", import.meta.url), new URL("../src/components/landing/packages-section.tsx", import.meta.url), new URL("../src/components/landing/contact-section.tsx", import.meta.url), ]; const footerPath = new URL("../src/components/footer27.tsx", import.meta.url); const indexPath = new URL("../src/pages/index.astro", import.meta.url); const impressumPath = new URL("../src/pages/impressum.astro", import.meta.url); const datenschutzPath = new URL("../src/pages/datenschutz.astro", import.meta.url); test("Landing component contains the core brief anchors", async () => { const source = ( await Promise.all(sourcePaths.map((p) => readFile(p, "utf8"))) ).join("\n"); for (const phrase of ["Online Fertig Passt", "01", "Website", "Kontakt", "für", "müssen", "Änderungen"]) { assert.match(source, new RegExp(phrase)); } }); test("Landing component uses real German umlauts in visible copy", async () => { const source = ( await Promise.all(sourcePaths.map((p) => readFile(p, "utf8"))) ).join("\n"); for (const asciiFallback of [ "fuer", "muessen", "spaetere", "Aenderungen", "glaubwuerdig", "naechste", "Agenturlaerm", "Erzaehlen", "Saetze", "Rueckmeldung", ]) { assert.doesNotMatch(source, new RegExp(asciiFallback)); } }); test("Landing page renders the footer with legal links", async () => { const [indexSource, footerSource] = await Promise.all([ readFile(indexPath, "utf8"), readFile(footerPath, "utf8"), ]); assert.match(indexSource, /import\s+\{\s*Footer27\s*\}/); assert.match(indexSource, //); assert.match(footerSource, /href="\/impressum"/); assert.match(footerSource, /href="\/datenschutz"/); assert.match(footerSource, /© 2026 Matthias Meister Webdesign/); assert.doesNotMatch(footerSource, /Bereit für eine Website/); assert.doesNotMatch(footerSource, /Kostenloses Angebot anfordern/); assert.doesNotMatch(footerSource, /max-w-6xl/); }); test("Legal pages contain required business and privacy information", async () => { const [impressumSource, datenschutzSource] = await Promise.all([ readFile(impressumPath, "utf8"), readFile(datenschutzPath, "utf8"), ]); for (const phrase of [ "Matthias Meister Softwareentwicklung", "Karl-Marx-Str. 22", "08451 Crimmitschau", "DE460155697", ]) { assert.match(impressumSource, new RegExp(phrase)); } for (const phrase of [ "keine Cookies", "mailto", "Rybbit", "rybbit.matthias.lol", ]) { assert.match(datenschutzSource, new RegExp(phrase)); } });