import {test} from 'node:test'; import assert from 'node:assert/strict'; import {readFileSync, readdirSync} from 'node:fs'; const read = p => readFileSync(p, 'utf8'); const model = JSON.parse(read('research/ai-adoption/strategy-model.json')); test('eight fixed strategy pages preserve target boundary and separate evidence', () => { assert.equal(model.pages.length, 8); assert.equal(readdirSync('docs/strategy').length, 8); for (const {id} of model.pages) { const page = read(`docs/strategy/${id}.mdx`); assert(page.includes(`id: ${id}`)); assert(page.includes('Target operating model')); assert(!/## Sources|\[\d+\]|Internal evidence mapping/.test(page)); assert(read('sidebars/strategy.ts').includes(`'${id}'`)); } for (const teams of Object.values(model.organization)) for (const name of teams) { assert(read('docs/organization/structure.mdx').includes(name)); assert(read('docs/strategy/target-operating-model.mdx').includes(name)); } }); test('every metric has an actionable reader-facing contract', () => { const page = read('docs/strategy/measurement.mdx'); assert.equal(model.kpis.length,16); for (const k of model.kpis) { const section=page.split(`### ${k.name}\n`)[1]?.split('\n### ')[0]; assert(section,k.name); for (const field of ['Eligible population','Exclusions','Events and source','Owner / cadence','Missing evidence','Gaming and limits']) assert(section.includes(`| ${field} |`)); assert(section.includes(k.owner)); } assert(page.includes('synthetic') && page.includes('not a production ingestion system')); }); test('diagram preserves independent release approval and no agent production authority', () => { const d=JSON.parse(read('diagrams/ai-adoption-target.architecture.json')); assert(d.meta.title.startsWith('TO-BE')); assert.equal(d.components.filter(n=>n.id==='coordinator').length,1); assert.deepEqual(d.connections.filter(e=>e.to==='release').map(e=>e.from),['approval']); for (const [from,to] of [['registry','coordinator'],['registry','clients'],['clients','gates'],['gates','approval'],['release','audit'],['audit','people']]) assert(d.connections.some(e=>e.from===from&&e.to===to)); assert(!d.connections.some(e=>['clients','coordinator'].includes(e.from)&&['release','approval'].includes(e.to))); assert(d.boundaries.some(b=>b.wraps.includes('gates')&&b.wraps.includes('release'))); });