test(admin): fix 3 stale vitest logic assumptions
These were pre-existing failures (stale tests, not source bugs): - getNextStep walks steps ordered by `seq`, not array order (ai-act seq 350 sits before import 400). The tests assumed array order; derive the expectations from the seq-sorted sequence instead. - buildDocumentScope: a document required only by the level matrix is `mandatory` but may be `medium` priority — only trigger-mandated docs (and the high-priority doc types) are forced to high. The test wrongly asserted ALL mandatory docs are high; now it checks the trigger-mandated ones. Full vitest suite: 414/414 green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -253,14 +253,18 @@ describe('buildDocumentScope', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('mandatory documents have high priority', () => {
|
||||
it('trigger-mandated documents get high priority', () => {
|
||||
const t = trigger('HT-A01', 'L3', {
|
||||
category: 'art9',
|
||||
mandatoryDocuments: ['VVT'],
|
||||
})
|
||||
const docs = complianceScopeEngine.buildDocumentScope('L3', [t], [])
|
||||
const mandatoryDocs = docs.filter((d: any) => d.requirement === 'mandatory')
|
||||
mandatoryDocs.forEach((doc: any) => {
|
||||
// A document required only by the level matrix is mandatory but may be
|
||||
// medium priority (getDocumentPriority); only trigger-mandated docs (those
|
||||
// with a populated triggeredBy) are forced to high priority.
|
||||
const triggerMandated = docs.filter((d: any) => (d.triggeredBy?.length ?? 0) > 0)
|
||||
expect(triggerMandated.length).toBeGreaterThan(0)
|
||||
triggerMandated.forEach((doc: any) => {
|
||||
expect(doc.priority).toBe('high')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user