import test from 'node:test'; import assert from 'node:assert/strict'; import {readFileSync} from 'node:fs'; import {spawnSync} from 'node:child_process'; import {fileURLToPath} from 'node:url'; // Building must not rewrite authored navigation; the packaged version is transformed in memory. test('website build preserves authored navigation source bytes',()=>{ const root=fileURLToPath(new URL('../',import.meta.url)); const source=new URL('../web/portal-navigation.js',import.meta.url); const before=readFileSync(source); const run=spawnSync(process.execPath,['scripts/build.mjs'],{cwd:root,encoding:'utf8',maxBuffer:1024*1024}); assert.equal(run.status,0,run.stderr||run.stdout||'Build failed'); assert.deepEqual(readFileSync(source),before,'Build unexpectedly rewrote navigation source'); assert.match(run.stdout,/Built Worker with \d+ embedded website assets/); });