Incognito-Wiki/tests/project-structure.test.mjs

18 lines
724 B
JavaScript

import assert from 'node:assert/strict';
import { readFile } 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\(/);
});