commit14
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
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 ['admin', 'finance']) {
|
||||
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);
|
||||
}
|
||||
for (const path of ['/facturas', '/pagamentos', '/requisicoes/tarefas?module=finance']) {
|
||||
const response = await viewer.request(path);
|
||||
assert.equal(response.status, 200, role + ' ' + path);
|
||||
const props = response.page.props;
|
||||
if (path.startsWith('/requisicoes')) {
|
||||
assert.equal(props.modules.finance, 'Finanças');
|
||||
assert.equal(props.filters.module, 'finance');
|
||||
routes.push({ role, path, total: props.tasks.total, result: 'passed' });
|
||||
} else {
|
||||
const data = props.invoices?.data ?? props.payments?.data;
|
||||
assert.ok(Array.isArray(data));
|
||||
assert.equal(path === '/facturas' ? props.focusInvoiceId : props.focusPaymentId, null);
|
||||
routes.push({ role, path, shown: data.length, result: 'passed' });
|
||||
}
|
||||
}
|
||||
}
|
||||
await fs.writeFile('docs/proofs/finance-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,
|
||||
note: 'Payment consultation retains its existing access audit; no financial decision is executed.'
|
||||
}, null, 2));
|
||||
console.log('Facturas, pagamentos e tarefas financeiras conferidos com as contas existentes.');
|
||||
` + '})()')(fs, assert);
|
||||
Reference in New Issue
Block a user