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

6 lines
864 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('L04 identity and task order are stable',()=>{assert.equal(source.card.number,'04');assert.equal(source.card.uuid,'ddcdbb08-80da-566e-a576-2e757848ae36');assert.deepEqual(source.tasks_order,['task01','task02','task03']);});
test('worktree, index and commit evidence are explicit',()=>{const text=JSON.stringify(source);for(const token of ['worktree','index','status','commit','trace.log'])assert.match(text,new RegExp(token,'i'));});
test('all task sources exist',async()=>{for(const name of ['task01_init_repository','task02_status_and_add','task03_first_commit'])await access(new URL(`../src/tasks/${name}.sh`,import.meta.url));});