28 lines
1.1 KiB
JavaScript
28 lines
1.1 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import { readFile, stat } from 'node:fs/promises';
|
|
import test from 'node:test';
|
|
|
|
const pairs = [
|
|
['block-1', 'period-1', 'discrete-mathematics'],
|
|
['block-1', 'period-1', 'procedural-programming'],
|
|
['block-2', 'period-2', 'calculus'],
|
|
['block-2', 'period-2', 'logic'],
|
|
['block-2', 'period-2', 'objects-in-programming'],
|
|
['block-4', 'period-4', 'data-structures-and-algorithms'],
|
|
['block-4', 'period-4', 'linear-algebra'],
|
|
];
|
|
|
|
test('shared courses have one body and two programme wrappers', async () => {
|
|
for (const [block, period, slug] of pairs) {
|
|
const partial = `src/content/shared-courses/year-1/${slug}.mdx`;
|
|
assert.ok((await stat(partial)).isFile());
|
|
for (const wrapper of [
|
|
`src/content/docs/data-science-and-ai/year-1/${block}/${slug}.mdx`,
|
|
`src/content/docs/computer-science/year-1/${period}/${slug}.mdx`,
|
|
]) {
|
|
const content = await readFile(wrapper, 'utf8');
|
|
assert.match(content, new RegExp(`shared-courses/year-1/${slug}\\.mdx`));
|
|
assert.doesNotMatch(content, /## Full course description/);
|
|
}
|
|
}
|
|
});
|