Files
lab-cpp-classes-objects/tests/card_contract.test.mjs
T
2026-07-21 20:11:42 +02:00

17 lines
800 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('CPP05 identity and task order are stable', () => {
assert.equal(source.card.number, '05');
assert.equal(source.card.uuid, '546e35f2-4c5b-5860-84a4-f5a879dda0dd');
assert.deepEqual(source.tasks_order, ['task01', 'task02', 'task03']);
assert.match(JSON.stringify(source), /C\+\+20/);
});
test('all task programs and expected outputs exist', async () => {
for (const task of ['task01', 'task02', 'task03']) {
await access(new URL(`../src/${task}/main.cpp`, import.meta.url));
await access(new URL(`./expected/${task}.txt`, import.meta.url));
}
});