Incognito-Wiki/tests/programme-content.test.mjs

25 lines
1 KiB
JavaScript

import assert from 'node:assert/strict';
import { readFile, stat } from 'node:fs/promises';
import test from 'node:test';
test('Data Science & AI owns the former generic bachelor content tree', async () => {
await assert.rejects(stat('src/content/docs/bachelor'), { code: 'ENOENT' });
assert.ok((await stat('src/content/docs/data-science-and-ai')).isDirectory());
for (const file of [
'docs/migration-manifest.json',
'docs/migration-report.md',
'docs/supplemental-content.json',
'scripts/audit-content.mjs',
'scripts/lib/migration.mjs',
'src/content/docs/index.mdx',
]) {
const content = await readFile(file, 'utf8');
assert.doesNotMatch(content, /src\/content\/docs\/bachelor\//, `${file} has an old destination`);
assert.doesNotMatch(content, /href="\.\/bachelor\/"/, `${file} has an old public link`);
}
const sidebar = await readFile('src/config/sidebar.mjs', 'utf8');
assert.doesNotMatch(sidebar, /slug: 'bachelor'/);
assert.match(sidebar, /slug: 'data-science-and-ai'/);
});