import assert from 'node:assert/strict'; import { readFile } from 'node:fs/promises'; import test from 'node:test'; const docsRoot = 'src/content/docs/useful-information'; test('Laptop Buying Advice publishes the newer hardware baseline without a dated warning', async () => { const content = await readFile(`${docsRoot}/laptop-buying-advice.md`, 'utf8'); assert.match(content, /16 GB/); assert.match(content, /512 GB/); assert.match(content, /Core i5-class or equivalent/i); assert.match(content, /M-series Mac/i); assert.match(content, /Nvidia[\s\S]*CUDA/i); assert.doesNotMatch(content, /:::caution\[Historical information\]/); }); const recoveredGuides = [ { slug: 'housing-guide', title: 'Housing Guide', source: 'https://wiki.msvincognito.nl/useful-guides/housing-guide', }, { slug: 'linux-tricks', title: 'Linux Tricks', source: 'https://wiki.msvincognito.nl/useful-guides/linux-tricks', }, { slug: 'surviving-dacs', title: 'Surviving DACS', source: 'https://wiki.msvincognito.nl/useful-guides/survivingdacs', }, ]; test('the three recovered guides are publishable native Markdown', async () => { for (const { slug, title } of recoveredGuides) { const content = await readFile(`${docsRoot}/${slug}.md`, 'utf8'); assert.match(content, new RegExp(`^---\\n[\\s\\S]*title: ${title}`)); assert.doesNotMatch(content, /^#\s+/m); assert.doesNotMatch(content, /:::caution\[Historical information\]/); assert.doesNotMatch(content, /\[\[|\{\{|NEWPAGE>|indexmenu>|~~NOCACHE~~/); } }); test('the recovered guide registry records source provenance', async () => { const supplemental = JSON.parse(await readFile('docs/supplemental-content.json', 'utf8')); for (const { slug, source } of recoveredGuides) { assert.deepEqual( supplemental.find(({ destination }) => destination === `${docsRoot}/${slug}.md`), { destination: `${docsRoot}/${slug}.md`, source, category: 'useful-guide-recovery', }, ); } }); test('published guides omit unsafe or legally questionable source recommendations', async () => { const linux = await readFile(`${docsRoot}/linux-tricks.md`, 'utf8'); const survival = await readFile(`${docsRoot}/surviving-dacs.md`, 'utf8'); assert.doesNotMatch(linux, /password=["']?/i); assert.doesNotMatch(survival, /Sci-Hub|Library Genesis|Library\.nu/i); });