Files
chimera-Public/test/server/ch-1401-autonomous-dependency-gate.test.js
T

42 lines
1.5 KiB
JavaScript

const test = require('node:test');
const assert = require('node:assert/strict');
async function queueLib() {
return import('../../scripts/autonomous/lib.mjs');
}
test('evidenced external blockers satisfy the legacy dependency policy', async () => {
const { dependenciesSatisfied } = await queueLib();
const dependency = {
id: 'CH-0001',
status: 'blocked_external',
notes: 'Concrete external evidence keeps host-complete follow-up work available.',
};
assert.equal(dependenciesSatisfied({ dependencies: [dependency.id] }, new Map([[dependency.id, dependency]])), true);
});
test('done_only dependency policy stops P15 follow-up after a blocked qualification gate', async () => {
const { dependenciesSatisfied, selectNextTask } = await queueLib();
const qualification = {
id: 'CH-1401',
status: 'blocked_external',
notes: 'The owned-hardware reference controls did not reach an exact title process.',
dependencies: [],
};
const adapter = {
id: 'CH-1402',
status: 'pending',
dependencies: [qualification.id],
dependency_policy: 'done_only',
};
const byId = new Map([[qualification.id, qualification], [adapter.id, adapter]]);
assert.equal(dependenciesSatisfied(adapter, byId), false);
assert.equal(selectNextTask({ tasks: [qualification, adapter] }), null);
qualification.status = 'done';
assert.equal(dependenciesSatisfied(adapter, byId), true);
assert.equal(selectNextTask({ tasks: [qualification, adapter] }), adapter);
});