import { invoiceLineTotal, invoiceTotals, } from '../src/procurement/supplier-invoice-money'; describe('supplier invoice money', () => { it('rounds line money and adds declared charges exactly', () => { const line = invoiceLineTotal('0.125', '120.03'); expect(line).toBe('15.00'); expect(invoiceTotals([{ lineTotal: line }], '2.70', '1.05')).toEqual({ merchandiseTotal: '15.00', payableTotal: '18.75', }); }); it('rejects column overflow with a distinct invoice error', () => { expect(() => invoiceLineTotal('999999999.999', '9999999999.99')).toThrow( expect.objectContaining({ code: 'INVOICE_AMOUNT_LIMIT' }), ); expect(() => invoiceTotals([{ lineTotal: '9999999999.00' }], '1.00', '0.00'), ).toThrow(expect.objectContaining({ code: 'INVOICE_AMOUNT_LIMIT' })); }); });