import {test} from 'node:test'; import assert from 'node:assert/strict'; import {readFileSync} from 'node:fs'; const read = p => readFileSync(p, 'utf8'); const stages = ['Scope', 'Architecture', 'UI/UX', 'Planning', 'Delivery', 'UAT', 'Releases']; test('Strategy opens at the autonomous lifecycle, with a matching direct landing story', () => { assert.match(read('sidebars/strategy.ts'), /strategySidebar: \['target-operating-model', 'index'/); for (const id of ['index', 'target-operating-model']) { const page = read(`docs/strategy/${id}.mdx`); const primary = page.split('
')[0]; assert(primary.includes('name="strategy-target"')); assert(primary.includes('autonomous agent')); assert(primary.includes('direct, guide and review')); assert(primary.includes('Scope → Architecture → UI/UX → Planning → Delivery → UAT → Releases → Scope')); assert(primary.includes('TO-BE')); assert(!/only routes|People authorize|independent gates protect release/.test(primary)); } }); test('both target diagrams have exactly seven sequential stages and a Releases to Scope return', () => { for (const suffix of ['', '-mobile']) { const d = JSON.parse(read(`diagrams/strategy-target${suffix}.architecture.json`)); const ids = stages.map(label => d.components.find(n => n.label === label)?.id); assert(ids.every(Boolean)); assert.equal(new Set(ids).size, 7); const flow = d.connections.filter(e => ids.includes(e.from) && ids.includes(e.to)); assert.deepEqual(flow.map(e => [e.from, e.to]), ids.map((id, i) => [id, ids[(i + 1) % ids.length]])); assert.match(flow.at(-1).label, /Repeat/); assert(flow.at(-1).via.length >= 2, 'explicit outside return corridor'); assert(d.components.some(n => n.label === 'Autonomous agent' && /Executes.*governs/.test(n.sublabel))); assert(d.components.some(n => n.label === 'Humans' && n.sublabel === 'Direct, guide and review')); assert(d.connections.some(e => e.from === 'humans' && e.to === 'agent')); assert(d.connections.some(e => e.from === 'agent' && e.to === ids[0])); } });