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

describe('sale getClaimableFromTicket()', () => {
    it('should return the claimable sales of a given ticket', async() => {
        const tx = await models.Sale.beginTransaction({});

        try {
            const options = {transaction: tx};

            const claimableFromTicket = await models.Sale.getClaimableFromTicket(16, options);

            expect(claimableFromTicket[0].concept).toBe('Ranged weapon longbow 200cm');
            expect(claimableFromTicket.length).toBe(3);

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