/** * Drift lock: the inline sensitivity-vocabulary tables embedded in the docs * (deployed standalone, markdown-only) must stay byte-consistent with the * canonical `lib/ba-sensitivity.ts` rendering. Edit BOTH or this suite fails. */ import { readFileSync } from 'node:fs' import { dirname, join } from 'node:path' import { fileURLToPath } from 'node:url' import { describe, expect, it } from 'vitest' import { renderSensitivityVocabTable } from '../ba-sensitivity.js' const skillsRoot = join(dirname(fileURLToPath(import.meta.url)), '..', '..') const CARRIERS = [ 'conventions/SKILL.md', 'business-analyse/create-data-model/levels/attributes.md', ] function extractBlock(md: string, marker: string, file: string): string { const re = new RegExp(`\\r?\\n([\\s\\S]*?)\\r?\\n`) const m = md.match(re) if (!m) throw new Error(`marker "${marker}" not found in ${file}`) return m[1].replace(/\r\n/g, '\n').trim() } describe.each(CARRIERS)('sensitivity-vocab drift — %s', (file) => { it('carries the sensitivity-vocab:v1 block equal to renderSensitivityVocabTable()', () => { const md = readFileSync(join(skillsRoot, file), 'utf8') expect(extractBlock(md, 'sensitivity-vocab:v1', file)).toBe(renderSensitivityVocabTable().trim()) }) })