Files
portfolio/tests/content.test.mjs
T
2026-11-09 15:19:44 +01:00

29 lines
1.3 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { projects, processes, source, revision } from '../content.js';
test('Evidence mappings use real process IDs and complete translations', () => {
assert.equal(processes.length, 8);
const ids = new Set(processes.map(p => p.code));
assert.equal(ids.size, 8);
assert.equal(new Set(projects.map(p => p.id)).size, projects.length);
for (const p of projects) {
for (const key of ['kind', 'title', 'name', 'intro', 'context', 'implementation', 'decisions']) {
assert.equal(p[key].length, 2, `${p.id}.${key}`);
assert.ok(p[key].every(s => typeof s === 'string' && s.length > 0));
}
for (const e of p.evidence) {
assert.ok(e.codes.every(c => ids.has(c)), e.path);
assert.ok(e.label.length === 2 && e.label.every(Boolean));
const url = new URL(source(e.path, e.directory));
assert.equal(url.hostname, 'github.com');
assert.ok(url.pathname.includes(revision));
assert.equal(decodeURIComponent(url.pathname.split(`${revision}/`)[1]), e.path);
}
}
});
test('Collaboration gaps remain explicit rather than claiming unsupported evidence', () => {
for (const code of ['B1-K2-W1', 'B1-K2-W2', 'B1-K2-W3']) {
assert.ok(!projects.some(p => p.evidence.some(e => e.codes.includes(code))));
}
});