Files
compras/scripts/workflow-task-inbox-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

47 lines
2.0 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');
const context = dashboard.page?.props.workContext ?? dashboard.page?.props.context;
const routes = [];
for (const [area, key, path] of [['procurement', 'procurement.internal', '/requisicoes/tarefas'], ['people', 'people.internal', '/pessoas/tarefas']]) {
if (context?.enforced && !context.available?.includes(key)) {
routes.push({ area, result: 'not_available_in_existing_scope' });
continue;
}
if (context?.enforced) {
assert.equal((await viewer.request('/contexto', 'POST', { area, option: key })).status, 302);
}
const response = await viewer.request(path);
assert.equal(response.status, 200);
assert.equal(response.page.props.area, area);
assert.ok(Array.isArray(response.page.props.tasks.data));
assert.ok(response.page.props.tasks.data.length <= 25);
assert.ok(response.page.props.tasks.total >= response.page.props.tasks.data.length);
routes.push({ area, result: 'passed', total: response.page.props.tasks.total, shown: response.page.props.tasks.data.length });
}
await fs.writeFile('docs/proofs/workflow-task-inbox-http.json', JSON.stringify({
checked_at: new Date().toISOString(), environment: base, routes, existing_account_used: true,
business_commands: false, accounts_or_grants_changed: false, sgf_installation_changed: false, visual_review: false
}, null, 2));
console.log('Listas de tarefas por área conferidas com o âmbito existente.');
` +
'})()',
)(fs, assert);