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>
53 lines
2.5 KiB
JavaScript
53 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',
|
|
'return (async()=>{' +
|
|
common +
|
|
`
|
|
const routes = [];
|
|
for (const role of ['procurement', 'finance', 'department_head']) {
|
|
const viewer = client();
|
|
await viewer.enter(role);
|
|
const dashboard = await viewer.request('/dashboard');
|
|
const context = dashboard.page?.props.workContext ?? dashboard.page?.props.context;
|
|
if (context?.enforced) {
|
|
assert.ok(context.available?.includes('procurement.internal'));
|
|
assert.equal((await viewer.request('/contexto', 'POST', { area: 'procurement', option: 'procurement.internal' })).status, 302);
|
|
}
|
|
const response = await viewer.request('/requisicoes/tarefas?module=purchases');
|
|
assert.equal(response.status, 200);
|
|
const tasks = response.page.props.tasks.data.filter(task => ['quotation_prepare', 'quotation_evaluate', 'quotation_check', 'comparison_review'].includes(task.task));
|
|
for (const task of tasks) {
|
|
const detail = await viewer.request(task.href);
|
|
assert.equal(detail.status, 200);
|
|
const props = detail.page.props;
|
|
if (task.task === 'quotation_prepare') {
|
|
assert.equal(props.canCreate, true);
|
|
assert.equal(props.prepare, true);
|
|
} else if (task.task === 'quotation_evaluate') {
|
|
assert.ok(props.quotations.find(quote => quote.id === props.focusQuotationId)?.canEvaluate);
|
|
}
|
|
}
|
|
routes.push({ role, purchase_tasks: response.page.props.tasks.total, shown_quotation_tasks: tasks.length, followed: tasks.length, result: 'passed' });
|
|
}
|
|
await fs.writeFile('docs/proofs/quotation-task-integration-http.json', JSON.stringify({
|
|
checked_at: new Date().toISOString(), environment: base, routes, existing_accounts_used: true,
|
|
business_commands: false, accounts_or_grants_changed: false, sgf_installation_changed: false,
|
|
visual_review: false, coverage: 'Current first-page tasks only; complete pending journeys covered by disposable tests.'
|
|
}, null, 2));
|
|
console.log('Consulta ao mercado e ligacoes das tarefas conferidas com os perfis existentes.');
|
|
` +
|
|
'})()',
|
|
)(fs, assert);
|