44 lines
2.0 KiB
JavaScript
44 lines
2.0 KiB
JavaScript
import { test } from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { existsSync, readFileSync } from 'node:fs'
|
|
|
|
const root = (rel) => new URL(`../${rel}`, import.meta.url)
|
|
|
|
const V = '2026-10-02'
|
|
const FILES = [`public/rechtliches/avv-website-analyse-${V}.html`, `public/rechtliches/leistungsbeschreibung-website-analyse-${V}.html`]
|
|
|
|
test('Analyse-Rechtstexte: versionierte Dateien tragen die Fassung, keine Entwurfs- oder Prüfhinweise, keine Kommentare', () => {
|
|
for (const f of FILES) {
|
|
assert.ok(existsSync(root(f)), f)
|
|
const html = readFileSync(root(f), 'utf8')
|
|
assert.ok(html.includes(`Fassung ${V}`), f)
|
|
assert.doesNotMatch(html, /<!--/, f)
|
|
assert.doesNotMatch(html, /Entwurf/, f)
|
|
assert.doesNotMatch(html, /Prüfpunkt/, f)
|
|
}
|
|
assert.match(readFileSync(root(FILES[0]), 'utf8'), /<h2>12\. Haftung/)
|
|
})
|
|
|
|
test('Entwurfsseite ohne Fassung ist nicht mehr als Datei vorhanden', () => {
|
|
assert.ok(!existsSync(root('public/rechtliches/avv-website-analyse.html')))
|
|
assert.ok(!existsSync(root('public/rechtliches/leistungsbeschreibung-website-analyse.html')))
|
|
})
|
|
|
|
test('AVV-Link im Portal zeigt auf eine ausgelieferte Adresse (Task 7 stellt auf die Fassung um)', () => {
|
|
const fn = readFileSync(root('public/funktionen.js'), 'utf8')
|
|
const url = fn.match(/const AVV_URL = '([^']+)'/)?.[1]
|
|
assert.equal(url, '/rechtliches/avv-website-analyse.html')
|
|
for (const f of FILES) assert.ok(existsSync(root(f)))
|
|
})
|
|
|
|
test('Portal: Dev-Modus-Hinweis an der Analyse-Kachel', () => {
|
|
const fn = readFileSync(root('public/funktionen.js'), 'utf8')
|
|
assert.match(fn, /Im Dev-Modus wird nicht gemessen/)
|
|
assert.match(fn, /a\.devMode/)
|
|
})
|
|
|
|
test('Texte: Akzentfarbe wird beim Einschalten gewählt (kein späteres Portal-Setting behauptet)', () => {
|
|
// Geprüfte Fassung 2026-10-02: nur die Leistungsbeschreibung sagt es so; die AVV nennt die Akzentfarbe unter den Einstellungen
|
|
assert.match(readFileSync(root('docs/rechtliches/leistungsbeschreibung-website-analyse.md'), 'utf8'), /beim Einschalten wählt/)
|
|
})
|