@@ -0,0 +1,51 @@
|
||||
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('keeps currencies separate and formats amounts without floating point', () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<ProcurementPaymentInsights
|
||||
data={{
|
||||
from: '2026-11-01',
|
||||
to: '2026-11-27',
|
||||
coverage: {
|
||||
invoices: 3,
|
||||
indeterminate: 1,
|
||||
confirmed_payments: 2,
|
||||
},
|
||||
currencies: [
|
||||
{
|
||||
currency: 'MZN',
|
||||
count: 1,
|
||||
amount_minor: '9007199254740993',
|
||||
},
|
||||
{ currency: 'USD', count: 1, amount_minor: '1200' },
|
||||
],
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
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(
|
||||
<ProcurementPaymentInsights
|
||||
data={{
|
||||
from: null,
|
||||
to: null,
|
||||
coverage: {
|
||||
invoices: 1,
|
||||
indeterminate: 1,
|
||||
confirmed_payments: 0,
|
||||
},
|
||||
currencies: [],
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
expect(html).toContain('histórico indeterminado');
|
||||
expect(html).not.toContain('0,00');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user