coverageManifest.test.mjs
2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import { existsSync } from 'node:fs'
import { resolve } from 'node:path'
import {
REQUIRED_NODES,
REQUIRED_EDGES,
REQUIRED_INTERFACES,
COVERAGE_CASES
} from './coverage.manifest.mjs'
describe('order lifecycle coverage manifest', () => {
it('IT-OL-COVERAGE-001: case ids are unique and stable', () => {
assert.ok(COVERAGE_CASES.length > 0)
const ids = COVERAGE_CASES.map(item => item.id)
assert.equal(new Set(ids).size, ids.length)
ids.forEach(id => assert.match(id, /^IT-OL-[A-Z]+-\d{3}$/))
})
it('IT-OL-COVERAGE-002: every required node is covered', () => {
assert.ok(REQUIRED_NODES.length > 0)
for (const node of REQUIRED_NODES) {
assert.ok(
COVERAGE_CASES.some(item => item.requirement === node),
`missing lifecycle node: ${node}`
)
}
})
it('IT-OL-COVERAGE-003: every required state edge is covered', () => {
assert.ok(REQUIRED_EDGES.length > 0)
for (const edge of REQUIRED_EDGES) {
assert.ok(
COVERAGE_CASES.some(item => item.stateEdge === edge),
`missing state edge: ${edge}`
)
}
})
it('IT-OL-COVERAGE-004: every critical interface is covered', () => {
assert.ok(REQUIRED_INTERFACES.length > 0)
for (const apiName of REQUIRED_INTERFACES) {
assert.ok(
COVERAGE_CASES.some(item => item.interfaces.includes(apiName)),
`missing interface: ${apiName}`
)
}
})
it('IT-OL-COVERAGE-005: manual cases contain executable guidance', () => {
const manualCases = COVERAGE_CASES.filter(entry => !entry.automated)
assert.ok(manualCases.length > 0)
for (const item of manualCases) {
assert.ok(item.manual?.reason)
assert.ok(item.manual?.preconditions?.length)
assert.ok(item.manual?.steps?.length)
assert.ok(item.manual?.targetLayer)
assert.match(item.testFile, /^manual:\/\//)
}
})
it('IT-OL-COVERAGE-006: automated evidence files exist in the repository', () => {
const automatedCases = COVERAGE_CASES.filter(entry => entry.automated)
assert.ok(automatedCases.length > 0)
for (const item of automatedCases) {
assert.ok(
existsSync(resolve(item.testFile)),
`${item.id} evidence file does not exist: ${item.testFile}`
)
}
})
})