commit melhorias compras5
tests / ci (push) Waiting to run

This commit is contained in:
2026-11-22 19:39:09 +02:00
parent 36dcfdf00c
commit db1615fac1
79 changed files with 4082 additions and 120 deletions
@@ -0,0 +1,48 @@
import { renderToStaticMarkup } from 'react-dom/server';
import { expect, test } from 'vitest';
import {
RequisitionCategoryFields,
requisitionCategoryLabels,
} from '@/components/requisition-category-fields';
test('classification fields explain the native controls and preserve the explicit investment reason', () => {
const html = renderToStaticMarkup(
<RequisitionCategoryFields
index={2}
category="capital_equipment"
reason="Investimento deliberado"
options={requisitionCategoryLabels}
onChange={() => {}}
/>,
);
expect(html).toContain('Justificação do investimento');
expect(html).toContain('Investimento deliberado');
expect(html).toContain('orçamento de investimento');
expect(html).toContain('aria-describedby="rq-category-2-help"');
expect(html).toContain('Peças sobressalentes');
});
test('legacy classification stays unselected and production guidance requires the published stock catalogue', () => {
const legacy = renderToStaticMarkup(
<RequisitionCategoryFields
index={0}
category=""
reason=""
options={requisitionCategoryLabels}
onChange={() => {}}
/>,
);
expect(legacy).toContain('Sem classificação adicional');
expect(legacy).toContain('não é inferida');
expect(legacy).not.toContain('<textarea');
const production = renderToStaticMarkup(
<RequisitionCategoryFields
index={1}
category="production_input"
reason=""
options={requisitionCategoryLabels}
onChange={() => {}}
/>,
);
expect(production).toContain('material de stock no catálogo publicado');
});