41 lines
1.9 KiB
JavaScript
41 lines
1.9 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'/);
|
|
});
|
|
|
|
test('Computer Science publishes only reviewed substantive branch content', async () => {
|
|
const pages = [
|
|
'src/content/docs/computer-science/index.md',
|
|
'src/content/docs/computer-science/year-1/index.md',
|
|
'src/content/docs/computer-science/year-1/period-1/introduction-to-computer-science.md',
|
|
'src/content/docs/computer-science/year-1/period-4/computer-architecture.md',
|
|
'src/content/docs/computer-science/year-1/period-5/algorithmic-design.md',
|
|
'src/content/docs/computer-science/year-1/period-5/databases.md',
|
|
'src/content/docs/computer-science/year-1/period-5/statistics.md',
|
|
];
|
|
const content = (await Promise.all(pages.map((page) => readFile(page, 'utf8')))).join('\n');
|
|
assert.doesNotMatch(content, /^#Hello$|Empty Page|course-description/im);
|
|
assert.match(content, /Introduction to Computer Science/);
|
|
assert.ok((await stat('src/content/docs/previous-exams-and-documents.md')).isFile());
|
|
});
|