32 lines
2.7 KiB
JavaScript
32 lines
2.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 routes=[];
|
|
for (const [role, expected] of [['admin',200],['procurement',403],['finance',403]]) {
|
|
const viewer=client(); await viewer.enter(role);
|
|
assert.equal((await viewer.request('/contexto','POST',{area:'procurement',option:'procurement.internal'})).status,302);
|
|
const history=await viewer.request('/compras/fornecimento?view=history'); assert.equal(history.status,expected);
|
|
if (expected===200) {
|
|
assert.equal(history.page.component,'supply/history'); assert.equal(history.page.encryptHistory,true);
|
|
assert.equal(history.page.props.canPrepare,false); assert.equal(history.page.props.canReview,false); assert.equal(history.page.props.records.length,0);
|
|
}
|
|
const tasks=await viewer.request('/requisicoes/tarefas?module=supply'); assert.equal(tasks.status,200);
|
|
const historical=tasks.page.props.tasks.data.filter(row=>row.task==='history_review'); assert.equal(historical.length,0);
|
|
routes.push({role,history_status:history.status,history_tasks:historical.length});
|
|
if (role==='admin') {
|
|
const pilot=await viewer.request('/stock/piloto'); assert.equal(pilot.status,200);
|
|
const r=pilot.page.props.report; assert.equal(r.tables.requisition_commands,true); assert.equal(r.tables.requisition_process_version,true);
|
|
assert.equal(r.checks.find(row=>row.key==='installation').ok,true);
|
|
assert.equal(r.checks.find(row=>row.key==='catalogue').ok,true); assert.equal(r.checks.find(row=>row.key==='replenishment').ok,true);
|
|
routes.push({role,pilot_installation:true,warehouse_scenario_ready:r.warehouse_scenario_ready,replenishment_scenario_ready:r.replenishment_scenario_ready,client_configuration_complete:r.client_configuration_complete});
|
|
}
|
|
}
|
|
await fs.writeFile('docs/proofs/history-task-integration-http.json',JSON.stringify({checked_at:new Date().toISOString(),result:'passed',environment:base,routes,
|
|
business_commands:false,accounts_or_grants_changed:false,sgf_installation_changed:false,visual_review:false,
|
|
coverage:'Existing current scope has no historical analysis and no historical execution grants; pending historical reviews tested only in disposable databases.'},null,2));
|
|
console.log('Historico, competencias especificas, tarefas e diagnostico da instalacao conferidos.');
|
|
` + '})()')(fs, assert);
|