Files
documentation/scripts/presentation.test.mjs
jarvis-at-skic f23bf1c5f4
Build and publish Eldorado documentation / build (pull_request) Successful in 48s
docs: align published presentation and verify horizon source traceability
2026-10-08 18:14:45 +00:00

36 lines
2.5 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import {readFileSync} from 'node:fs';
import {createHash} from 'node:crypto';
import {execFileSync} from 'node:child_process';
import {slides} from '../presentations/less-prompting-more-shipping/slides.mjs';
const read=p=>readFileSync(p,'utf8');
test('deck preserves assignment coverage, 35+15 timing and traceable notes',()=>{
assert.equal(slides.length,19); assert.equal(new Set(slides.map(s=>s.id)).size,19);
assert.equal(slides.slice(0,17).reduce((n,s)=>n+s.minutes,0),35);
assert.equal(slides[17].minutes,15); assert.equal(slides[18].minutes,0);
for(const s of slides){assert(s.sources.length);assert(s.notes.length>250);assert(s.body.length);}
for(const id of ['months-one-two','months-three-four','months-five-six','measures','month-six','beyond']) assert(slides.some(s=>s.id===id));
for(const id of ['experiment','inconclusive','stop']) assert.match(slides.find(s=>s.id===id).body,/fictional/i);
assert.match(slides.find(s=>s.id==='qualification').notes,/separately authorizes/);
});
test('build emits local pinned Reveal assets, stable IDs and no production CDN',()=>{
execFileSync(process.execPath,['scripts/build-presentations.mjs']);
const dir='static/presentations/less-prompting-more-shipping'; const html=read(`${dir}/index.html`);
assert.equal((html.match(/<section /g)||[]).length,19);
assert.equal((html.match(/class="notes"/g)||[]).length,19);
assert(!/https?:\/\//.test(html));
assert.match(html,/href="\.\.\/\.\.\/strategy\/target-operating-model\/"/);
assert.match(read(`${dir}/assets/reveal.js`),/5\.2\.1/);
assert.match(read(`${dir}/runtime.js`),/hash:true/);
assert.equal(JSON.parse(read('package.json')).dependencies['reveal.js'],'5.2.1');
assert.match(read('src/pages/index.tsx'),/Open presentation/);
const map=JSON.parse(read(`${dir}/source-map.json`));
assert.equal(map.version,'1.0.1');
assert.match(map.strategyRevision,/same-build/);
for(const doc of map.sourceDocuments) assert.equal(doc.sha256,createHash('sha256').update(read(doc.path)).digest('hex'),doc.path);
for(const id of ['target-operating-model','roadmap','six-months-target','six-months-roadmap','stage-02-autonomous-agent']) assert(map.sourceDocuments.some(d=>d.id===id),id);
assert(slides.find(s=>s.id==='beyond').notes.includes('long-term destination remains human-directed'));
for(const id of ['months-one-two','months-three-four','months-five-six','capacity','experiment','inconclusive','stop']) assert(slides.find(s=>s.id===id).sources.includes('six-months-roadmap'),id);
});