Files
codex-bot ad398db781
waterfall-wiki CI and deployment / verify-and-deploy (push) Has been cancelled
studio CI and deployment / verify-and-deploy (push) Successful in 9m15s
Restore PROMPT branding, rename waterfall-wiki, and add system tag workflows
2026-10-27 00:35:59 +08:00

17 lines
1.3 KiB
JavaScript

import {createRequire} from 'node:module';
import {readFile,access} from 'node:fs/promises';
import {fileURLToPath} from 'node:url';
import path from 'node:path';
import assert from 'node:assert/strict';
const root=path.resolve(path.dirname(fileURLToPath(import.meta.url)),'../..'),require=createRequire(path.join(root,'apps/waterfall-wiki/package.json')),sharp=require('sharp');
const layouts=JSON.parse(await readFile(path.join(root,'content/layout-reference/manifest.json'),'utf8'));
const file=url=>path.join(root,'content/layout-reference/assets',url.slice('asset:'.length));
assert.equal(layouts.length,27);assert.equal(new Set(layouts.map(l=>l.id)).size,27);
for(const l of layouts){
const actual=await sharp(file(l.background)).composite(l.elements.map(e=>({input:file(e.asset),left:e.box[0],top:e.box[1]}))).removeAlpha().raw().toBuffer(),expected=await sharp(file(l.reference)).removeAlpha().raw().toBuffer();
assert.ok(actual.equals(expected),l.id);
for(const e of l.elements)for(const key of ['asset','mask','underlay'])if(e[key])await access(file(e[key]));
}
assert.deepEqual(layouts[0].elements.filter(e=>e.kind==='text').map(e=>e.id),['T01','T02']);
console.log('27 authoring manifests and 217 classified components verified; all physical composites equal their source crops.');