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>
46 lines
2.1 KiB
JavaScript
46 lines
2.1 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 records=[];
|
|
for(const role of ['admin','warehouse','procurement','finance']) {
|
|
const viewer=client(); await viewer.enter(role);
|
|
assert.equal((await viewer.request('/contexto','POST',{area:'procurement',option:'procurement.internal'})).status,302);
|
|
for(const due of ['all','overdue','today','upcoming','undated']) {
|
|
const result=await viewer.request('/requisicoes/tarefas?due='+due);
|
|
assert.equal(result.status,200);
|
|
const props=result.page.props;
|
|
assert.equal(result.page.encryptHistory,true);
|
|
assert.equal(props.filters.due,due);
|
|
assert.match(props.asOf,/^\\d{4}-\\d{2}-\\d{2}$/);
|
|
if(due!=='all') {
|
|
assert.equal(props.tasks.total,props.deadlineCounts[due]);
|
|
assert.ok(props.tasks.data.every(task=>task.due_status===due));
|
|
} else {
|
|
assert.equal(props.tasks.total,Object.values(props.deadlineCounts).reduce((sum,value)=>sum+value,0));
|
|
}
|
|
records.push({role,due,status:result.status,total:props.tasks.total});
|
|
}
|
|
assert.equal((await viewer.request('/requisicoes/tarefas?due=invalid')).status,422);
|
|
}
|
|
await fs.writeFile('docs/proofs/task-deadlines-http.json',JSON.stringify({checked_at:new Date().toISOString(),environment:base,result:'passed',records,
|
|
business_commands:false,accounts_or_grants_changed:false,sgf_changed:false,visual_review:false,
|
|
coverage:'Existing synthetic profiles and actual task projections; populated date boundary and pagination scenarios tested in disposable databases.'},null,2));
|
|
console.log('Prazos da caixa de tarefas conferidos em leitura no piloto.');
|
|
` +
|
|
'})()',
|
|
)(fs, assert);
|