60 lines
2 KiB
JavaScript
60 lines
2 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import { readFile, stat } from 'node:fs/promises';
|
|
import test from 'node:test';
|
|
|
|
test('package scripts expose the local workflow', async () => {
|
|
const pkg = JSON.parse(await readFile('package.json', 'utf8'));
|
|
assert.equal(pkg.scripts.dev, 'astro dev');
|
|
assert.equal(pkg.scripts.build, 'astro build');
|
|
assert.equal(pkg.scripts.check, 'astro check && node --test');
|
|
assert.equal(pkg.scripts.test, 'node --test');
|
|
});
|
|
|
|
test('Astro configuration is environment-portable', async () => {
|
|
const config = await readFile('astro.config.mjs', 'utf8');
|
|
assert.match(config, /process\.env\.SITE/);
|
|
assert.match(config, /process\.env\.BASE/);
|
|
assert.match(config, /starlight\(/);
|
|
});
|
|
|
|
test('Incognito branding assets and configuration are present', async () => {
|
|
for (const asset of [
|
|
'public/favicon.ico',
|
|
'src/assets/logo.svg',
|
|
'src/assets/logo-dark.png',
|
|
]) {
|
|
const details = await stat(asset);
|
|
assert.ok(details.size > 0, `${asset} should not be empty`);
|
|
}
|
|
|
|
const config = await readFile('astro.config.mjs', 'utf8');
|
|
assert.match(config, /customCss/);
|
|
assert.match(config, /logo/);
|
|
assert.match(config, /dark:\s*'\.\/src\/assets\/logo\.svg'/);
|
|
assert.match(config, /light:\s*'\.\/src\/assets\/logo-dark\.png'/);
|
|
assert.match(config, /favicon/);
|
|
assert.match(config, /https:\/\/msvincognito\.nl\//);
|
|
});
|
|
|
|
test('the landing and association pages are available', async () => {
|
|
for (const page of [
|
|
'src/content/docs/index.mdx',
|
|
'src/content/docs/about-incognito.md',
|
|
]) {
|
|
const details = await stat(page);
|
|
assert.ok(details.size > 0, `${page} should not be empty`);
|
|
}
|
|
});
|
|
|
|
test('landing page navigation uses the migration manifest destinations', async () => {
|
|
const landingPage = await readFile('src/content/docs/index.mdx', 'utf8');
|
|
for (const destination of [
|
|
'./bachelor/',
|
|
'./master-ai/',
|
|
'./master-dsdm/',
|
|
'./useful-information/',
|
|
'./about-incognito/',
|
|
]) {
|
|
assert.ok(landingPage.includes(`href="${destination}"`), `missing ${destination}`);
|
|
}
|
|
});
|