55 lines
3.3 KiB
JavaScript
55 lines
3.3 KiB
JavaScript
import {test} from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import {readFileSync, existsSync} from 'node:fs';
|
|
import {runInNewContext} from 'node:vm';
|
|
import ts from 'typescript';
|
|
const read = p => readFileSync(p, 'utf8');
|
|
|
|
test('Strategy has Target, Roadmap, a linked Skills Adoption category and Autonomous Agent', () => {
|
|
const compiled = ts.transpileModule(read('sidebars/strategy.ts'), {compilerOptions:{module:ts.ModuleKind.CommonJS}}).outputText;
|
|
const sandbox = {exports:{}};
|
|
runInNewContext(compiled, sandbox);
|
|
const sidebar = JSON.parse(JSON.stringify(sandbox.exports.default.strategySidebar));
|
|
assert.deepEqual(sidebar, ['target-operating-model', 'roadmap', 'six-months-target', {
|
|
type:'category', label:'6 Months Roadmap',
|
|
link:{type:'doc', id:'six-months-roadmap'}, collapsed:true,
|
|
items:[
|
|
'stage-01-skills-adoption',
|
|
{type:'category', label:'Measurement', collapsed:true, link:{type:'doc', id:'measurement/index'}, items:[
|
|
...JSON.parse(read('research/ai-adoption/measurement-migration.json')).metrics.map(m => m.docId),
|
|
'measurement/collection-and-safeguards','measurement/synthetic-example',
|
|
]},
|
|
{type:'doc', id:'baseline', label:'Baseline'},
|
|
{type:'doc', id:'skills-governance', label:'Governance'},
|
|
{type:'doc', id:'skills-quality', label:'Quality'},
|
|
{type:'doc', id:'skills-adoption', label:'Adoption'},
|
|
{type:'doc', id:'skills-maintenance', label:'Maintenance'},
|
|
|
|
],
|
|
}, 'stage-02-autonomous-agent']);
|
|
assert.match(read('docs/strategy/target-operating-model.mdx'), /^sidebar_label: Target$/m);
|
|
assert.match(read('docusaurus.config.ts'), /type: 'docSidebar', docsPluginId: 'strategy', sidebarId: 'strategySidebar', label: 'Strategy'/);
|
|
});
|
|
|
|
test('stage overviews explain the foundation and future without replacing topic content', () => {
|
|
const first = read('docs/strategy/stage-01-skills-adoption.mdx');
|
|
const second = read('docs/strategy/stage-02-autonomous-agent.mdx');
|
|
for (const [id, title, page] of [
|
|
['stage-01-skills-adoption', 'Skills lifecycle reference', first],
|
|
['stage-02-autonomous-agent', 'Beyond 6 Months', second],
|
|
]) {
|
|
assert(page.includes(`id: ${id}\ntitle: ${title}`));
|
|
for (const link of ['./roadmap.mdx', './target-operating-model.mdx']) assert(page.includes(link));
|
|
}
|
|
for (const id of ['measurement/index','baseline','skills-governance','skills-quality','skills-adoption','skills-maintenance']) assert(first.includes(`./${id}.mdx`));
|
|
for (const marker of ['human + AI Agent','Delivery first','order is not yet decided','KPIs','baseline','topology','feedback','new current situation']) assert(first.includes(marker), marker);
|
|
for (const marker of ['future','proven skills','measurements','working practices','direction and review','not deployed autonomy','approved KPI thresholds']) assert(second.includes(marker), marker);
|
|
assert.match(read('docs/strategy/measurement/index.mdx'), /^title: Measuring real output\nsidebar_label: Measurement$/m);
|
|
});
|
|
|
|
test('old Strategy entry redirects to Target instead of maintaining a second document', () => {
|
|
assert(!existsSync('docs/strategy/index.mdx'));
|
|
assert.match(read('docusaurus.config.ts'), /'@docusaurus\/plugin-client-redirects'/);
|
|
assert.match(read('docusaurus.config.ts'), /from: '\/strategy\/', to: '\/strategy\/target-operating-model\/'/);
|
|
});
|