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>
45 lines
2.5 KiB
JavaScript
45 lines
2.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',
|
|
'outputFile',
|
|
'return (async()=>{' +
|
|
common +
|
|
`
|
|
const rows=[], prints=new Set();
|
|
const paths=['/ordens','/recepcoes','/stock','/stock/requisicoes','/equipamentos','/orcamentos','/facturas','/pagamentos','/planeamento','/revisao-compras','/relatorios','/relatorios/medidas-fornecedores','/compras/fornecimento?view=calendar','/compras/fornecimento?view=imports','/compras/acordos/vigencia'];
|
|
for(const role of ['admin','procurement','finance','warehouse']){
|
|
const viewer=client();await viewer.enter(role);
|
|
assert.equal((await viewer.request('/contexto','POST',{area:'procurement',option:'procurement.internal'})).status,302);
|
|
for(const path of paths){
|
|
const response=await viewer.request(path);assert.ok([200,403,503].includes(response.status),role+' '+path+' '+response.status);
|
|
const props=response.page?.props??{};
|
|
const list=props.orders?.data??props.receipts?.data??props.requests?.data??props.records?.data??[];
|
|
rows.push({role,path,status:response.status,component:response.page?.component??null,visible_page_records:Array.isArray(list)?list.length:null});
|
|
if(role==='procurement'&&path==='/ordens')for(const item of list.slice(0,2))prints.add('/ordens/'+item.id+'/imprimir');
|
|
if(role==='procurement'&&path==='/recepcoes')for(const item of list.slice(0,2))prints.add('/recepcoes/'+item.id+'/imprimir');
|
|
}
|
|
if(role==='admin'){
|
|
const change=await viewer.request('/contexto','POST',{area:'people',option:'people.internal'});
|
|
if(change.status===302)for(const path of ['/pessoas','/pessoas/tarefas','/pessoas/relatorios','/pessoas/cadastro']){
|
|
const r=await viewer.request(path);assert.ok([200,403,503].includes(r.status));
|
|
rows.push({role,path,status:r.status,component:r.page?.component??null,visible_page_records:r.page?.props.processes?.data?.length??null});
|
|
}
|
|
}
|
|
}
|
|
await fs.writeFile(outputFile,JSON.stringify({environment:base,scope:'existing authorised records only',rows,print_paths:[...prints],business_commands:false,visual_review:false},null,2));
|
|
console.log(JSON.stringify({routes_checked:rows.length,print_paths:[...prints],statuses:rows.reduce((a,r)=>(a[r.status]=(a[r.status]??0)+1,a),{})}));
|
|
` +
|
|
'})()',
|
|
)(fs, assert, process.argv[2] ?? 'docs/proofs/final-review-inventory.json');
|