Files
lab-console-git-basics-2/tests/card_contract.test.mjs
T

6 lines
865 B
JavaScript

import assert from 'node:assert/strict'; import { access, readFile } from 'node:fs/promises'; import test from 'node:test';
const source=JSON.parse(await readFile(new URL('../json/card_source.json',import.meta.url),'utf8'));
test('L05 identity and task order are stable',()=>{assert.equal(source.card.number,'05');assert.equal(source.card.uuid,'6c357743-5c79-568f-9577-1871542c21da');assert.deepEqual(source.tasks_order,['task01','task02','task03']);});
test('history, diff and safe restore evidence are explicit',()=>{const text=JSON.stringify(source);for(const token of ['HEAD','index','worktree','restore','trace.log'])assert.match(text,new RegExp(token,'i'));});
test('all task sources exist',async()=>{for(const name of ['task01_read_history','task02_compare_diffs','task03_restore_safely'])await access(new URL(`../src/tasks/${name}.sh`,import.meta.url));});