Files
lab-console-neovim/tests/card_contract.test.mjs
T

6 lines
870 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('L03 identity and task order are stable',()=>{assert.equal(source.card.number,'03');assert.equal(source.card.uuid,'bcbeea7b-d87a-5b1c-9364-c19edddf86ce');assert.deepEqual(source.tasks_order,['task01','task02','task03']);});
test('navigation, edit, write and history evidence are explicit',()=>{const text=JSON.stringify(source);for(const token of ['cursor','search','write','undo','redo','trace.log'])assert.match(text,new RegExp(token,'i'));});
test('all task sources exist',async()=>{for(const name of ['task01_navigation','task02_search_edit_save','task03_undo_redo'])await access(new URL(`../src/tasks/${name}.sh`,import.meta.url));});