3 lines
1.9 KiB
JavaScript
3 lines
1.9 KiB
JavaScript
import fs from 'node:fs';import assert from 'node:assert/strict';import crypto from 'node:crypto';
|
|
const root=JSON.parse(fs.readFileSync('C:/laragon/data/sgf-tempo/run/modular-regression-current.json')).root+'/private/receipt-composition-cc50a276c10c',s=JSON.parse(fs.readFileSync(root+'/state.json')),checks=[];const names=['sgf-entry-menu','sgf-stock-final','sgf-stock-completion','sgf-stock-catalogue','sgf-service-documents','sgf-cash','sgf-iva','sgf-fiscal-rules','sgf-bank','sgf-indicators'];for(const name of names){const path='/'+name+'.mjs',r=await fetch('http://127.0.0.1:8085'+path),bytes=Buffer.from(await r.arrayBuffer());assert.equal(r.status,200,path);assert(/javascript|ecmascript/.test(r.headers.get('content-type')),path+' JavaScript MIME');assert.equal(crypto.createHash('sha256').update(bytes).digest('hex'),crypto.createHash('sha256').update(fs.readFileSync(s.app+'/public'+path)).digest('hex'),path+' published bytes');checks.push(path+' actual JavaScript MIME and exact bytes');}const queried=await fetch('http://127.0.0.1:8085/sgf-stock-final.mjs?check=1');assert(/javascript/.test(queried.headers.get('content-type')));checks.push('query string preserves module delivery');const missing=await fetch('http://127.0.0.1:8085/unknown-sgf-module.mjs');assert.equal(missing.status,404);assert(!/html/.test(missing.headers.get('content-type')));checks.push('missing module404 not application HTML');const old=await fetch('http://127.0.0.1:8085/stock-operations-workspace.mjs');assert.equal(old.status,200);assert(/javascript/.test(old.headers.get('content-type')));checks.push('existing physical operations script still served');const file=root+'/assets-http-20261110.json';fs.writeFileSync(file,JSON.stringify({passed:true,checks,business_commands:0,database_writes:0,browser_visual_review:false},null,2));console.log(JSON.stringify({passed:true,checks:checks.length,proof:file}));
|