@synotech/utils
Version:
a collection of utilities for internal use
34 lines (30 loc) • 617 B
text/typescript
import { invoiceTotals } from '../invoiceTotal';
describe('calculate invoice doc totals', () => {
const doc = {
number: 10001,
objectId: 'testDocObject',
discountAmount: 0,
discountPercentage: 0,
taxableSubTotal: 438.5,
paid: 0,
adjustment: 0,
shipping: 0,
};
const docProducts = [{ qty: 2, price: 100, tax: 15 }];
const taxes = [
{
name: 'VAT',
category: 'sales',
value: 15,
},
{
name: 'None',
category: 'sales',
value: 0,
},
];
it('calculates', async () => {
const { total } = await invoiceTotals(doc, docProducts, taxes);
expect(total).toEqual(230);
});
});