2 lines
2.7 KiB
JavaScript
2 lines
2.7 KiB
JavaScript
import fs from'node:fs';import assert from'node:assert/strict';import crypto from'node:crypto';import{session}from'./sgf-single-http.mjs';const root=JSON.parse(fs.readFileSync('C:/laragon/data/sgf-tempo/run/modular-regression-current.json')).root+'/private/receipt-composition-cc50a276c10c',p=JSON.parse(fs.readFileSync(root+'/hp-http-progress-private.json')),checks=[],ok=(v,n)=>{assert(v,n);checks.push(n);},s=await session('hr:hr_read','human_resources');let r=await s.get('/api/hr-personnel?'+new URLSearchParams({kind:'entitlement',worker_key:p.worker_key,page:1,per_page:25}));assert.equal(r.status,200);const body=await r.json(),ent=body.records.data.find(r=>r.record_key===p.keys.entitlement);ok(ent.current_balance.available_minutes===480&&ent.current_balance.taken_minutes===480&&ent.current_balance.reserved_minutes===0,'current condition balance reflects actual effective requests');ok(ent.data.result.available_minutes===960&&ent.data.result.reserved_minutes===0,'original reviewed condition snapshot remains960');ok(ent.current_balance.basis==='current_effective_requests_at_read','current balance basis explicit');r=await s.get('/api/hr-personnel/exports/'+p.steps['report-review'].result.id);assert.equal(r.status,200);ok(Buffer.from(await r.arrayBuffer()).equals(fs.readFileSync(root+'/hp-frozen-period-private.csv')),'frozen period export unchanged after current-balance projection');const entry=await fetch('http://127.0.0.1:8085/sgf'),html=await entry.text();for(const m of['commercial','purchasing','stock','workshop','finance','accounting','human_resources'])ok(html.includes('data-presentation-module="'+m+'"'),'entry preserved '+m);ok(html.includes('Cadastro, contratos, assiduidade, férias'),'HR entry describes delivered functions');const manifest=JSON.parse(fs.readFileSync(root+'/app/public/build/manifest.json'));for(const e of Object.values(manifest).filter(v=>v.isEntry||/PersonnelWorkspace|RemunerationsWorkspace|WorkspaceHome|statement-download/.test(v.file))){r=await fetch('http://127.0.0.1:8085/build/'+e.file);const b=Buffer.from(await r.arrayBuffer());ok(r.status===200&&/javascript/.test(r.headers.get('content-type'))&&crypto.createHash('sha256').update(b).digest('hex')===crypto.createHash('sha256').update(fs.readFileSync(root+'/app/public/build/'+e.file)).digest('hex'),'final JS MIME SHA '+e.file);if(e.file.includes('PersonnelWorkspace'))ok(b.toString().includes('Saldo efectivo nesta consulta'),'served interface distinguishes current from frozen balance');}const file=root+'/hp-final-http-20261111.json';fs.writeFileSync(file,JSON.stringify({passed:true,checks,business_commands:0,browser_visual_review:false},null,2));console.log(JSON.stringify({passed:true,checks:checks.length,proof:file}));
|