@@ -4,7 +4,7 @@ import { expect, test } from 'vitest';
|
||||
import { RequisitionApprovalSettings } from '@/components/requisition-approval-settings';
|
||||
import { procurementNavigation } from '@/lib/procurement-navigation';
|
||||
|
||||
function render(ready: boolean) {
|
||||
function render(ready: boolean, categoryOptions: Record<string, string> = {}) {
|
||||
return renderToStaticMarkup(
|
||||
<App
|
||||
initialComponent={RequisitionApprovalSettings}
|
||||
@@ -17,6 +17,7 @@ function render(ready: boolean) {
|
||||
props: {
|
||||
errors: {},
|
||||
ready,
|
||||
categoryOptions,
|
||||
version: 4,
|
||||
profiles: [
|
||||
{
|
||||
@@ -42,6 +43,13 @@ function render(ready: boolean) {
|
||||
scope: 'company',
|
||||
min_minor: 11601,
|
||||
categories: ['Material'],
|
||||
...(Object.keys(categoryOptions).length
|
||||
? {
|
||||
procurement_categories: [
|
||||
'office_equipment',
|
||||
],
|
||||
}
|
||||
: {}),
|
||||
cost_center_ids: [1],
|
||||
},
|
||||
],
|
||||
@@ -52,6 +60,24 @@ function render(ready: boolean) {
|
||||
);
|
||||
}
|
||||
|
||||
test('explicit RQ01 group conditions are separate from original article categories and remain hidden until available', () => {
|
||||
const html = render(true, {
|
||||
office_equipment: 'Equipamento de escritório',
|
||||
capital_equipment: 'Maquinaria',
|
||||
});
|
||||
expect(html).toContain('Categoria da necessidade (RQ-01)');
|
||||
expect(html).toContain('Categorias exactas do artigo');
|
||||
expect(html).toContain('Equipamento de escritório');
|
||||
expect(html).toContain('Maquinaria');
|
||||
expect(html).toContain('não são classificados automaticamente');
|
||||
const groups = html.slice(
|
||||
html.indexOf('Categoria da necessidade (RQ-01)'),
|
||||
html.indexOf('Perfis elegíveis'),
|
||||
);
|
||||
expect(groups).toContain('checked=""');
|
||||
expect(render(true)).not.toContain('Categoria da necessidade (RQ-01)');
|
||||
});
|
||||
|
||||
test('approval settings retain exact threshold and selected revoked profiles so the administrator can reconcile the plan', () => {
|
||||
const html = render(true);
|
||||
expect(html).toContain('116.01');
|
||||
|
||||
Reference in New Issue
Block a user