tests: the restart and logs groups, the nine-group checklist and the fixture clean-up (#25)

This commit is contained in:
2026-11-15 12:52:20 +01:00
parent 70a984c55a
commit cedb80aa96
7 changed files with 474 additions and 13 deletions
+37
View File
@@ -0,0 +1,37 @@
// The M3 acceptance checklist as a test: the nine groups of DESIGN 13 exist, each points at a real
// harness in tools/, and each carries the named test that proves it (DESIGN 14, #12 / #25). This
// fails if someone renames a group test or deletes a group file, so `devbox run test` cannot go
// green with a group silently unproven.
import test from 'node:test'
import assert from 'node:assert/strict'
import fs from 'node:fs'
import path from 'node:path'
import { GROUP_COUNT, GROUPS } from './groups.mjs'
import { projectRoot } from './lib.mjs'
const tools = path.join(projectRoot, 'tools')
test('M3 accept: the nine groups of DESIGN 13 are mapped to named harness tests', () => {
assert.deepEqual(Object.keys(GROUPS), [
'leak+fault', 'tiles', 'probing', 'protocol', 'auth', 'characters and names', 'restart',
'persistence', 'logs',
], 'the group names are the ones of DESIGN 13 (FIXED #12)')
assert.equal(Object.keys(GROUPS).length, GROUP_COUNT)
for (const [group, spec] of Object.entries(GROUPS)) {
for (const file of spec.files) {
const full = path.join(tools, file)
assert.ok(fs.existsSync(full), `${group}: ${file} exists`)
assert.ok(fs.statSync(full).size > 0, `${group}: ${file} is not empty`)
}
assert.ok(spec.evidence.length >= 1, `${group}: names its proving test`)
for (const [file, needle] of spec.evidence) {
const text = fs.readFileSync(path.join(tools, file), 'utf8')
assert.ok(text.includes(needle), `${group}: ${file} contains the test "${needle}"`)
}
}
// Every *group* harness is run by `tools/test.sh` (one glob over tools/*.test.mjs).
const globbed = fs.readdirSync(tools).filter(f => f.endsWith('.test.mjs'))
for (const spec of Object.values(GROUPS)) {
for (const file of spec.files) assert.ok(globbed.includes(file), `${file} is run by devbox run test`)
}
})