import { App } from '@inertiajs/react'; import { renderToStaticMarkup } from 'react-dom/server'; import { expect, test } from 'vitest'; import { RequisitionApprovalSettings } from '@/components/requisition-approval-settings'; import { procurementNavigation } from '@/lib/procurement-navigation'; function render(ready: boolean) { return renderToStaticMarkup( ', profile_ids: [7, 8], scope: 'company', min_minor: 11601, categories: ['Material'], cost_center_ids: [1], }, ], }, }, }} />, ); } 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'); expect(html).toContain('Conferência <QA>'); expect(html).toContain('Direcção QA'); expect(html).toContain('Consulta revogada QA'); expect(html).toContain('Sem competência de aprovação actualmente'); expect(html).toContain('basta um aprovador'); expect(html).toContain('apenas a novas submissões'); }); test('unavailable capability explains the existing circuit without offering a nonfunctional plan form', () => { const html = render(false); expect(html).toContain('O circuito actual permanece em vigor'); expect(html).not.toContain(' { const entries = procurementNavigation( ['requisition_approve'], false, ).flatMap((group) => group.entries); expect( entries.some((entry) => entry.path === '/requisicoes?view=approvals'), ).toBe(true); expect(entries.some((entry) => entry.path === '/facturas')).toBe(false); expect(entries.some((entry) => entry.path === '/fornecedores')).toBe(false); });