commit21
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
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,expected] of [['admin',200],['warehouse',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);
|
||||
for(const path of ['/stock/ocorrencias','/stock/estornos']) {
|
||||
const result=await viewer.request(path+'?source_search=TEST&source_form_key=prepare:new');assert.equal(result.status,expected);
|
||||
if(expected===200) {
|
||||
assert.equal(result.page.encryptHistory,true);assert.equal(result.page.props.capabilities.prepare,false);
|
||||
assert.deepEqual(result.page.props.receipts,[]);if(path==='/stock/estornos') assert.deepEqual(result.page.props.operations,[]);
|
||||
assert.equal((await viewer.request(path+'?source_search='+ 'A'.repeat(101))).status,422);
|
||||
}
|
||||
records.push({role,path,status:result.status});
|
||||
}
|
||||
}
|
||||
await fs.writeFile('docs/proofs/correction-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 read rights; positive old origins and native reversals tested in disposable databases.'},null,2));
|
||||
console.log('Pesquisa de origens de correcção conferida sem decisões, concessões ou movimentos no piloto.');
|
||||
`+'})()')(fs,assert);
|
||||
Reference in New Issue
Block a user