Initial curated chimera source from a8ae5b1db07fb49926c94585e2718e5130330974
This commit is contained in:
commit
c737a37f71
531 files changed
+119270
No files matched your search
@@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const fixtures = JSON.parse(
|
||||
fs.readFileSync(path.join(__dirname, 'fixtures', 'chimera-baseline-fixtures.json'), 'utf8')
|
||||
);
|
||||
|
||||
test('baseline fixture harness represents full coverage, partial coverage, inaccessible roots and staged jobs', () => {
|
||||
assert.equal(fixtures.schema_version, 1);
|
||||
assert.ok(Array.isArray(fixtures.scan_roots), 'scan roots are present');
|
||||
assert.ok(Array.isArray(fixtures.installs), 'install fixture rows are present');
|
||||
assert.ok(Array.isArray(fixtures.version_evidence), 'version evidence rows are present');
|
||||
assert.ok(Array.isArray(fixtures.devices), 'devices are present');
|
||||
assert.ok(Array.isArray(fixtures.jobs), 'jobs are present');
|
||||
|
||||
const coverageStates = new Set(fixtures.scan_roots.map((row) => row.coverage_state));
|
||||
assert.ok(coverageStates.has('complete'), 'complete coverage is representable');
|
||||
assert.ok(coverageStates.has('partial'), 'partial coverage is representable');
|
||||
assert.ok(coverageStates.has('inaccessible'), 'inaccessible roots are representable');
|
||||
|
||||
const installsByTitle = fixtures.installs.reduce((acc, install) => {
|
||||
(acc[install.title_id] ||= []).push(install);
|
||||
return acc;
|
||||
}, {});
|
||||
const multiset = Object.entries(installsByTitle).find(([, value]) => value.length > 1);
|
||||
assert.ok(multiset, 'a title can represent multiple installs');
|
||||
assert.equal(new Set(multiset[1].map((item) => item.location)).size, 2);
|
||||
|
||||
const stagedJobs = fixtures.jobs.filter((job) => job.status === 'staged');
|
||||
const activeRetryJobs = fixtures.jobs.filter((job) => job.status === 'interrupted');
|
||||
assert.ok(stagedJobs.length > 0, 'staged jobs are representable');
|
||||
assert.ok(activeRetryJobs.length > 0, 'staged/retry jobs are representable');
|
||||
|
||||
for (const job of fixtures.jobs) {
|
||||
assert.ok(typeof job.job_id === 'string' && job.job_id.length > 0);
|
||||
assert.ok(typeof job.title_id === 'string' && job.title_id.length > 0);
|
||||
assert.ok(typeof job.kind === 'string' && job.kind.length > 0);
|
||||
assert.ok(typeof job.confidence === 'string' && job.confidence.length > 0);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user