22 lines
1.8 KiB
JavaScript
22 lines
1.8 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 records=[];
|
|
for(const role of ['admin','procurement','finance']) {
|
|
const viewer=client();await viewer.enter(role);
|
|
assert.equal((await viewer.request('/contexto','POST',{area:'procurement',option:'procurement.internal'})).status,302);
|
|
const page=await viewer.request('/compras/fornecimento?view=calendar&history_stock_item_id=1&history_warehouse_id=1&history_purpose=internal&history_period_from=2026-10-01&history_period_until=2026-10-31&history_form_key=prepare:new');
|
|
assert.equal(page.status,200);assert.equal(page.page.encryptHistory,true);assert.equal(page.page.props.historyFormKey,'prepare:new');
|
|
if(!page.page.props.canPrepare) assert.deepEqual(page.page.props.histories,[]);
|
|
assert.equal((await viewer.request('/compras/fornecimento?view=calendar&history_period_from=2026-10-01')).status,422);
|
|
records.push({role,can_prepare:page.page.props.canPrepare,source_choices:page.page.props.histories.length});
|
|
}
|
|
await fs.writeFile('docs/proofs/history-source-http.json',JSON.stringify({checked_at:new Date().toISOString(),environment:base,result:'passed',records,
|
|
business_commands:false,accounts_or_grants_changed:false,sgf_installation_changed:false,visual_review:false,
|
|
coverage:'Existing pilot scope and lookup validation; approved historical periods and suspensions tested in disposable databases.'},null,2));
|
|
console.log('Pesquisa de análises conferida sem criar origens, decisões ou acessos no piloto.');
|
|
`+'})()')(fs,assert);
|