Só formatação automática (pint, vp check --fix), sem alterar comportamento. Excluídos da formatação os registos e artefactos com bytes fixos: docs/, integrations/, storage/, tmp/, output/, resources/data/, tests/Fixtures/, compras-release.json e AGENTS*.md. Scripts operacionais, integrations e auxiliares de teste ficam fora do lint (usam new Function; limpeza na fase 2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
1.5 KiB
JavaScript
36 lines
1.5 KiB
JavaScript
import fs from 'node:fs/promises';
|
|
import assert from 'node:assert/strict';
|
|
|
|
const source = await fs.readFile(
|
|
'scripts/supplier-evaluation-check.mjs',
|
|
'utf8',
|
|
);
|
|
const common = source.slice(
|
|
source.indexOf('const base ='),
|
|
source.indexOf('const author ='),
|
|
);
|
|
await new Function(
|
|
'fs',
|
|
'assert',
|
|
'return (async()=>{' +
|
|
common +
|
|
`
|
|
const results=[];
|
|
for(const role of ['admin','procurement','finance']) {
|
|
const viewer=client(); await viewer.enter(role);
|
|
assert.equal((await viewer.request('/contexto','POST',{area:'procurement',option:'procurement.internal'})).status,302);
|
|
const response=await viewer.request('/relatorios');
|
|
assert.equal(response.status,200);
|
|
const available=['admin','finance'].includes(role) && response.page.props.payablesAvailable===true;
|
|
assert.equal(response.page.props.payableInsights!==null,available);
|
|
const csv=await viewer.request('/relatorios/obrigacoes.csv','GET',undefined,false);
|
|
assert.equal(csv.status,available?200:403);
|
|
if(available) assert.ok(csv.text.includes('Principal (centavos)'));
|
|
results.push({role,report_status:response.status,native_positions_available:available,csv_status:csv.status});
|
|
}
|
|
await fs.writeFile('docs/proofs/payable-insights-pilot-http.json',JSON.stringify({environment:base,result:'passed',results,business_commands:false,session_context_only:true,visual_review:false},null,2));
|
|
console.log(JSON.stringify({http_checks:results.length*2,result:'passed',business_commands:false}));
|
|
` +
|
|
'})()',
|
|
)(fs, assert);
|