commit14
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
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);
|
||||
Reference in New Issue
Block a user