const models = require('vn-loopback/server/server').models;

describe('invoiceIn getTotals()', () => {
    it('should check that returns invoiceIn totals', async() => {
        const invoiceInId = 1;
        const tx = await models.InvoiceIn.beginTransaction({});
        const options = {transaction: tx};

        try {
            const invoiceIntotals = await models.InvoiceIn.getTotals(invoiceInId, options);

            expect(typeof invoiceIntotals.totalTaxableBase).toBe('number');
            expect(invoiceIntotals.totalTaxableBase).toEqual(invoiceIntotals.totalDueDay);

            await tx.rollback();
        } catch (e) {
            await tx.rollback();
            throw e;
        }
    });
});