commit de compras
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import fs from 'node:fs';import path from 'node:path';import assert from 'node:assert/strict';
|
||||
const read=p=>JSON.parse(fs.readFileSync(p,'utf8')),state=read('C:/laragon/data/sgf-tempo/run/modular-regression-current.json'),tag=process.argv[2];if(state.port!==55439||!/^[a-f0-9]{12}$/.test(tag??''))throw Error('Owned QA tag required');
|
||||
const root=path.join(state.root,'private/ledger-'+tag),demo=read(path.join(root,'ledger-demo.json')),output=path.join(root,'ledger-demo-http.json');if(fs.existsSync(output))throw Error('Completed demo proof preserved');let checks=0;const check=(v,s)=>{checks++;assert(v,s);};
|
||||
const base=new URL(demo.url).origin,landing=await fetch(demo.url);check(landing.status===200&&(await landing.text()).includes('data-ledger-demo="'+tag+'"'),'Persistent dedicated loopback demo ready');
|
||||
for(const role of ['prepare','validate','read']){
|
||||
const jar=new Map();let auth;
|
||||
const request=async url=>{const r=await fetch(base+url,{headers:{Accept:'application/json',Cookie:[...jar].map(([k,v])=>k+'='+v).join('; '),'X-SGF-Context':auth?.context??''},redirect:'manual'});for(const c of r.headers.getSetCookie()){const p=c.split(';')[0],at=p.indexOf('=');jar.set(p.slice(0,at),p.slice(at+1));}const text=await r.text();let data;try{data=JSON.parse(text);}catch{}return{status:r.status,text,data};};
|
||||
const entry=await request('/qa/ledger-enter/'+role);check(entry.status===200,'Team identity '+role);auth=entry.data;check(jar.has(demo.cookie),'Dedicated cookie does not replace existing demo cookies');
|
||||
const api=await request('/api/general-ledger');check(api.status===200&&api.data.journals.length===0&&api.data.proposals.length===0,'Pristine readable workflow '+role);
|
||||
const html=await request('/general-ledger');check(html.status===200&&html.text.includes('Trocar função no ensaio sintético')&&(role==='prepare'?html.text.includes('data-action="prepare"'):!html.text.includes('data-action="prepare"')),'Role-specific preparation interface '+role);
|
||||
}
|
||||
fs.writeFileSync(output,JSON.stringify({passed:true,checks,url:demo.url,loopback_only:true,cookie_isolated:true,no_business_commands_executed:true,role_interfaces_verified:true,visual_review:false,browser_interactions_tested:false},null,2)+'\n');console.log(JSON.stringify({passed:true,checks,url:demo.url,pristine:true}));
|
||||
Reference in New Issue
Block a user