2021-07-12 10:50:15 +00:00
|
|
|
const models = require('vn-loopback/server/server').models;
|
2021-04-15 08:44:25 +00:00
|
|
|
|
|
|
|
describe('invoiceIn summary()', () => {
|
|
|
|
it('should return a summary object containing data from one invoiceIn', async() => {
|
2021-07-12 10:50:15 +00:00
|
|
|
const tx = await models.InvoiceIn.beginTransaction({});
|
2021-06-28 08:15:54 +00:00
|
|
|
const options = {transaction: tx};
|
2021-04-15 08:44:25 +00:00
|
|
|
|
2021-06-28 08:15:54 +00:00
|
|
|
try {
|
2021-07-12 10:50:15 +00:00
|
|
|
const summary = await models.InvoiceIn.summary(1, options);
|
2021-06-28 08:15:54 +00:00
|
|
|
|
|
|
|
expect(summary.supplierRef).toEqual('1234');
|
2021-08-12 05:39:26 +00:00
|
|
|
expect(summary.totals.totalTaxableBase).toEqual(352.24);
|
2021-06-28 08:15:54 +00:00
|
|
|
|
|
|
|
await tx.rollback();
|
|
|
|
} catch (e) {
|
|
|
|
await tx.rollback();
|
|
|
|
throw e;
|
|
|
|
}
|
2021-04-15 08:44:25 +00:00
|
|
|
});
|
|
|
|
});
|