test(ms-ai-architect): Spor 1 — akseptansetester (residual scoped, worklist-aktivering, CT5/N4, poison-doc) [skip-docs]
This commit is contained in:
parent
cec98b5cb5
commit
ed92d65385
3 changed files with 134 additions and 1 deletions
|
|
@ -18,6 +18,7 @@ import {
|
|||
checkN5,
|
||||
checkCT5,
|
||||
} from '../../scripts/kb-eval/eval.mjs';
|
||||
import { insertHeaderFields, insertToc } from '../../scripts/kb-update/lib/transform.mjs';
|
||||
|
||||
test('splitFrontmatter — separates frontmatter from body', () => {
|
||||
const c = '---\nname: x\ndescription: hi\n---\n# Body\nline2\n';
|
||||
|
|
@ -294,3 +295,40 @@ test('checkCT5 — 0.80 is the pass threshold (mirrors the old K8 ratio target)'
|
|||
assert.equal(checkCT5(mk(5, 4)).pass, true, '4/5 = 0.80 passes');
|
||||
assert.equal(checkCT5(mk(5, 3)).pass, false, '3/5 = 0.60 fails');
|
||||
});
|
||||
|
||||
// --- Spor 1 acceptance: CT5 sourcedness ACTIVATES and N4 TOC passes on the migrated
|
||||
// substrate. Fixtures are produced by the REAL Session-2 primitives (insertHeaderFields
|
||||
// + insertToc) applied to legacy files — so this asserts the substrate makes both
|
||||
// signals move, not that a hand-forged header does.
|
||||
|
||||
// A legacy LARGE reference file (>100 lines), no Type/Source/TOC.
|
||||
const LEGACY_LARGE = '# Big Reference\n\n**Status:** GA\n\n---\n\n' +
|
||||
Array.from({ length: 8 }, (_, i) => `## Section ${i + 1}\n\n${'body paragraph.\n'.repeat(14)}`).join('\n');
|
||||
const MIGRATED_LARGE = insertToc(insertHeaderFields(LEGACY_LARGE, {
|
||||
type: 'reference', source: 'https://learn.microsoft.com/azure/big',
|
||||
}));
|
||||
const MIGRATED_SMALL = insertHeaderFields('# Small Reference\n\n**Status:** GA\n\n---\n\n## A\n\ntekst\n', {
|
||||
type: 'reference', source: 'https://learn.microsoft.com/azure/small',
|
||||
});
|
||||
const MIGRATED_REFS = [
|
||||
{ path: 'references/big.md', content: MIGRATED_LARGE },
|
||||
{ path: 'references/small.md', content: MIGRATED_SMALL },
|
||||
];
|
||||
|
||||
test('acceptance — CT5 activates on the migrated substrate (referenceFiles>0, fully sourced, pass)', () => {
|
||||
const r = checkCT5(MIGRATED_REFS);
|
||||
// referenceFiles>0 is the score-layer's "available" predicate — CT5 is no longer dormant.
|
||||
assert.ok(r.referenceFiles > 0, 'CT5 available: at least one type:reference file');
|
||||
assert.equal(r.referenceFiles, 2);
|
||||
assert.equal(r.sourced, 2);
|
||||
assert.equal(r.ratio, 1);
|
||||
assert.equal(r.pass, true);
|
||||
});
|
||||
|
||||
test('acceptance — N4 passes: the migrated large file carries a recognised ## Innhold TOC', () => {
|
||||
const r = checkN4(MIGRATED_REFS);
|
||||
assert.ok(r.largeFiles >= 1, 'the large file is in N4 scope');
|
||||
assert.equal(r.withToc, r.largeFiles, 'every large file has a TOC');
|
||||
assert.equal(r.ratio, 1);
|
||||
assert.equal(r.pass, true);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue