// @requirements REQ-PRODUCT-SERVICE-CATALOG REQ-PRODUCT-SETUP import {test} from 'node:test';import assert from 'node:assert/strict';import {readFile} from 'node:fs/promises';import {build} from 'esbuild'; const root=new URL('../dist/public/',import.meta.url); test('setup opts into a lazy offline seed with its notices while ordinary consent graphs stay independent',async()=>{ const script=await readFile(new URL('assets/setup.mjs',root),'utf8');assert.match(script,/loadCatalog:\(\)=>import\('\/assets\/catalog-seed.mjs'\)/);assert.doesNotMatch(script,/fetch\(|XMLHttpRequest|sendBeacon/); const seed=await readFile(new URL('assets/catalog-seed.mjs',root),'utf8');assert.match(seed,/Open Cookie Database contributors/);assert.match(seed,/\/assets\/catalog\/NOTICE.txt/);assert.equal(await readFile(new URL('assets/catalog/NOTICE.txt',root),'utf8'),await readFile(new URL('../../catalog/NOTICE',import.meta.url),'utf8'));assert.equal(await readFile(new URL('assets/catalog/open-cookie-database-LICENSE.txt',root),'utf8'),await readFile(new URL('../../catalog/sources/open-cookie-database/LICENSE',import.meta.url),'utf8')); const graph=await build({entryPoints:[new URL('assets/runtime/setup-ui.js',root).pathname],bundle:true,write:false,metafile:true,platform:'browser'});assert.ok(Object.keys(graph.metafile.inputs).some(p=>p.includes('catalog-ui.js')));assert.ok(Object.keys(graph.metafile.inputs).some(p=>p.includes('setup-purpose-ui.js')));assert.ok(Object.keys(graph.metafile.inputs).some(p=>p.includes('catalog-review-ui.js')));assert.ok(Object.keys(graph.metafile.inputs).every(p=>!p.includes('catalog-review-cli')));assert.ok(Object.keys(graph.metafile.inputs).every(p=>!p.includes('catalog-data')&&!p.includes('catalog-seed')&&!p.includes('notabenda-cf')&&!p.includes('setup-purpose-cli'))); const visitor=await readFile(new URL('assets/consent.mjs',root),'utf8');assert.doesNotMatch(visitor,/catalog-seed|catalog-service-selection|mountCatalogPicker|mountPurposeEditor/); });