import {test} from 'node:test'; import assert from 'node:assert/strict'; import {readFileSync} from 'node:fs'; import {createHash} from 'node:crypto'; const read=p=>readFileSync(p,'utf8'); const slugs=['product','technology','operations','marketing','finance-accounting','hr-administration']; test('all six department bodies are preserved exactly and absent from overview',()=>{ const manifest=JSON.parse(read('research/organization/department-migration.json')); assert.deepEqual(manifest.departments.map(d=>d.slug),slugs); const overview=read('docs/organization/structure.mdx'); for(const d of manifest.departments){ const page=read(`docs/organization/structure/${d.slug}.mdx`); const body=page.replace(/^---\n[\s\S]*?\n---\n/, '').split('[Return to Structure overview]')[0].trim(); assert.equal(createHash('sha256').update(body).digest('hex'),d.bodySha256,d.slug); assert(!overview.includes(body)); assert(overview.includes(`./structure/${d.slug}.mdx`)); assert(page.includes('(../structure.mdx)')); } assert.deepEqual(manifest.departments.map(d=>d.rows),[2,5,4,6,3,3]); }); test('Structure is a linked category with six direct children and preserved peers',()=>{ const sidebar=read('sidebars/organization.ts'); assert(sidebar.includes("link: {type: 'doc', id: 'structure'}")); assert.deepEqual([...sidebar.matchAll(/'structure\/([^']+)'/g)].map(m=>m[1]),slugs); assert(sidebar.includes("'collaboration', 'sdlc'")); });