Files
compras/scripts/warehouse-pilot-readiness-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

27 lines
1.7 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');
const dashboard=await viewer.request('/dashboard');
if(dashboard.page?.props.context?.enforced)await viewer.request('/contexto','POST',{area:'procurement',option:'procurement.internal'});
const response=await viewer.request('/stock/piloto');assert.equal(response.status,200);assert.equal(response.page.component,'stock/pilot');
const p=response.page.props;assert.equal(p.syntheticEvaluation,true);assert.ok(p.report.checks.length>=6);assert.ok(Array.isArray(p.report.registered));assert.ok(Array.isArray(p.report.participants.prepare));assert.equal(typeof p.report.warehouse_scenario_ready,'boolean');
await fs.writeFile('docs/proofs/warehouse-pilot-readiness-http.json',JSON.stringify({checked_at:new Date().toISOString(),environment:base,component:'stock/pilot',synthetic_evaluation:true,registered_count:p.report.registered.length,warehouse_scenario_ready:p.report.warehouse_scenario_ready,replenishment_scenario_ready:p.report.replenishment_scenario_ready,client_configuration_complete:p.report.client_configuration_complete,checks:p.report.checks.map(c=>({key:c.key,ok:c.ok})),accounts_or_grants_changed:false,business_commands:false,visual_browser_review:false},null,2));
console.log('Diagnóstico do piloto conferido por HTTP sem alterar configurações ou executar compras.');
` +
'})()',
)(fs, assert);