import { App } from '@inertiajs/react'; import { renderToStaticMarkup } from 'react-dom/server'; import { expect, test } from 'vitest'; import ExpenseAllocation from '../../resources/js/pages/payments/expense-allocation'; import { ProcurementCategoryInsights } from '../../resources/js/components/procurement-category-insights'; function render(canWrite: boolean) { return renderToStaticMarkup( Serviços'], fingerprint: 'a'.repeat(64), current: { id: 1, version: 1, reason: 'Synthetic explicit allocation', data: { allocations: [ { category: 'Material', amount_minor: '1500' }, ], }, }, history: { data: [], prev_page_url: null, next_page_url: null, }, }, }} />, ); } test('read-only financial viewer sees the preserved attribution without a write form', () => { const html = render(false); expect(html).toContain('15,00 MZN'); expect(html).not.toContain(' { const html = render(true); expect(html).toContain('Usar a imputação actual como preparação'); expect(html).toContain('<script>Serviços</script>'); expect(html).not.toContain('value="15.00"'); expect(html).toContain('Guardar imputação'); }); test('category summary preserves unassigned expenses and separates currencies without allocating them automatically', () => { const html = renderToStaticMarkup( , ); expect(html).toContain('Despesa não imputada: 40,00 USD'); expect(html).toContain('Imputação indeterminada: 50,00 MZN'); expect(html).toContain('15,00 MZN'); expect(html).toContain('Não há distribuição proporcional automática'); expect(html).toContain('category_page=2'); expect(html).toContain('supplier_page=2'); });