Files
compras/scripts/received-availability-http.mjs
T
nalaandClaude Opus 5.5 ec934455e7 Aplicar Pint e formatação de frontend; delimitar o âmbito do lint
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>
2026-11-30 23:01:42 +02:00

38 lines
1.9 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 viewer=client(); await viewer.enter('admin');
assert.equal((await viewer.request('/contexto','POST',{area:'people',option:'people.internal'})).status,302);
const index=await viewer.request('/pessoas'); assert.equal(index.status,200);
let dossiersChecked=0; let availabilityRows=0;
for(const process of index.page.props.processes.data.slice(0,2)) {
const dossier=await viewer.request('/pessoas/'+process.id+'/dossier.json','GET',undefined,false);
assert.equal(dossier.status,200);
assert.equal(dossier.page.schema,'sgc.people.process-dossier.v1');
assert.equal(dossier.page.effect,'preparation_only');
const page=await viewer.request('/pessoas/'+process.id); assert.equal(page.status,200);
assert.deepEqual(dossier.page.candidates,page.page.props.candidates);
availabilityRows+=dossier.page.candidates.filter(row=>row.received_availability).length;
assert.equal(dossier.page.process.tenant_id,undefined);
assert.equal(dossier.page.process.creation_hash,undefined);
dossiersChecked++;
}
await fs.writeFile('docs/proofs/received-availability-http.json',JSON.stringify({checked_at:new Date().toISOString(),environment:base,result:'passed',dossiersChecked,availabilityRows,business_commands:false,visual_review:false,coverage:'Existing visible processes only; positive received-availability cases exercised in disposable tests.'},null,2));
console.log('People page/dossier availability projection checked for existing visible sources only.');
` +
'})()',
)(fs, assert);