Build and publish Eldorado documentation / build (pull_request) Successful in 29s
39 lines
2.2 KiB
JavaScript
39 lines
2.2 KiB
JavaScript
import {test} from 'node:test';
|
||
import {createHash} from 'node:crypto';
|
||
import assert from 'node:assert/strict';
|
||
import {readFileSync, existsSync} from 'node:fs';
|
||
const read = p => readFileSync(p, 'utf8');
|
||
test('vendored source matches the reviewed upstream snapshot', () => {
|
||
const checksums = JSON.parse(read('vendor/archify-checksums.json'));
|
||
for (const [path, hash] of Object.entries(checksums)) {
|
||
assert.equal(createHash('sha256').update(readFileSync(`vendor/archify/${path}`)).digest('hex'), hash, path);
|
||
}
|
||
});
|
||
test('three independent section menus and Structure first', () => {
|
||
const config = read('docusaurus.config.ts');
|
||
for (const section of ['Organization', 'Strategy', 'Contribution']) assert(config.includes(`label: '${section}'`));
|
||
assert(!config.includes("label: 'Documentation'"));
|
||
assert(!config.includes("label: 'Maintainer guide'"));
|
||
assert(read('sidebars/organization.ts').includes("organizationSidebar: ['structure']"));
|
||
for (const section of ['organization','strategy','contribution']) assert(config.includes(`id: '${section}'`));
|
||
});
|
||
test('Archify is pinned, licensed and rebuilt, not a remote embed', () => {
|
||
const provenance = JSON.parse(read('vendor/archify-provenance.json'));
|
||
assert.equal(provenance.commit, 'd5a1333d7447c866a765adac7d4d062f2f02e4d2');
|
||
assert(read('vendor/archify/LICENSE').includes('MIT License'));
|
||
const scripts = JSON.parse(read('package.json')).scripts;
|
||
assert(scripts.build.startsWith('pnpm diagrams:build'));
|
||
const wrapper = read('src/components/ArchifyDiagram/index.tsx');
|
||
assert(wrapper.includes('sandbox="allow-scripts allow-downloads"'));
|
||
assert(!wrapper.includes('allow-same-origin'));
|
||
assert(wrapper.includes('useBaseUrl'));
|
||
});
|
||
test('example is explicitly illustrative and contains valid connected nodes', () => {
|
||
const spec = JSON.parse(read('diagrams/organization-structure.architecture.json'));
|
||
assert(spec.meta.title.includes('Illustrative'));
|
||
const ids = new Set(spec.components.map(n => n.id));
|
||
assert.equal(ids.size, spec.components.length);
|
||
for (const edge of spec.connections) assert(ids.has(edge.from) && ids.has(edge.to));
|
||
assert(read('docs/organization/structure.mdx').includes('not Eldorado’s confirmed organization chart'));
|
||
});
|