import { renderToStaticMarkup } from 'react-dom/server';
import { describe, expect, it } from 'vitest';
import { ProcurementPaymentInsights } from '../../resources/js/components/procurement-payment-insights';
describe('confirmed payment expense', () => {
it('describes one confirmed payment in the singular without changing the exact amount', () => {
const html = renderToStaticMarkup(
,
);
expect(html).toContain('1 pagamento confirmado.');
expect(html).toContain('40,00 MZN');
expect(html).not.toContain('1 pagamentos');
});
it('shows supplier identity with exact totals and preserves filters in its independent pagination', () => {
const html = renderToStaticMarkup(
synthetic',
currency: 'MZN',
count: 1,
amount_minor: '9007199254740993',
},
],
total: 21,
current_page: 2,
last_page: 2,
},
}}
/>,
);
expect(html).toContain('Despesa por fornecedor');
expect(html).toContain('<script>synthetic</script>');
expect(html).toContain('90.071.992.547.409,93 MZN');
expect(html).toContain('supplier_page=1');
expect(html).toContain('search=REQ-QA');
expect(html).toContain('Página 2 de 2');
});
it('keeps currencies separate and formats amounts without floating point', () => {
const html = renderToStaticMarkup(
,
);
expect(html).toContain('90071992547409,93 MZN');
expect(html).toContain('12,00 USD');
expect(html).toContain('valores apresentados são parciais');
expect(html).toContain('pela data de confirmação');
});
it('does not describe undetermined history as a zero expense', () => {
const html = renderToStaticMarkup(
,
);
expect(html).toContain('histórico indeterminado');
expect(html).not.toContain('0,00');
});
});