test(playground): require every inlined demo report to equal its fixture

The demo block is output of scripts/build-demo-state.mjs, so each inlined report must equal playground/test-fixtures/<id>.md. Red on 70731af: classify, requirements, conformity, review, adr and summary differ. The block carries the corrected AI Act deadlines while the fixtures still carry 2027-08-02, so the next rebuild would silently put the old dates back in the demo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-09-23 15:03:52 +02:00
commit d670e7b3ee
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q

View file

@ -62,6 +62,17 @@ test('the demo project description names the domain its reports are about', () =
);
});
// The demo block is build output: every inlined report must equal its fixture.
// A block edited in place while the fixture kept older text is a demo that the
// next rebuild silently reverts.
test('every inlined demo report equals its fixture', () => {
const { reports } = demoProject();
const stale = Object.entries(reports)
.filter(([id, r]) => readFileSync(`${pluginRoot}playground/test-fixtures/${id}.md`, 'utf8') !== r.raw_markdown)
.map(([id]) => id);
assert.deepEqual(stale, [], `inlined reports differ from playground/test-fixtures/: ${stale.join(', ')}`);
});
test('the inlined demo project description matches the build script', () => {
const { description } = demoProject();
const source = readFileSync(pluginRoot + BUILD_SCRIPT, 'utf8');