// Site public : pages accessibles sans compte, SEO, en-têtes, aucune ressource externe, marqueurs légaux, contrastes. import { test, before, after } from 'node:test'; import assert from 'node:assert/strict'; import { readFileSync } from 'node:fs'; import { startApp, APP_URL } from './helpers/server.js'; import { LEGAL_MARKERS } from '../src/site/legal.js'; import { CONSENT_CHECKBOX } from '../src/claudelink.js'; let s; before(async () => { s = await startApp(); }); after(async () => { await s.close(); }); const PUBLIC_PAGES = ['/', '/fonctionnement', '/tarifs', '/mentions-legales', '/confidentialite', '/cgu']; const read = (p) => readFileSync(new URL(`../${p}`, import.meta.url), 'utf8'); // Les clients de test envoient accept: application/json ; un navigateur demande du HTML const page = (p, headers = {}) => s.anon.get(p, { headers: { accept: 'text/html', ...headers } }); const text = async (p) => (await page(p)).text(); test('pages publiques : 200 sans session, complètes (une h1, title, description, canonical, lang)', async () => { for (const p of PUBLIC_PAGES) { const r = await page(p); assert.equal(r.status, 200, p); assert.match(r.headers.get('content-type'), /text\/html/); const h = await r.text(); assert.match(h, //, p); assert.equal((h.match(/