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

describe('Agency landsThatDay()', () => {
    const ctx = beforeAll.getCtx();
    const today = Date.vnNew();
    it('should return a list of agencies that can land a shipment on a day for an address', async() => {
        const tx = await models.Agency.beginTransaction({});

        try {
            const options = {transaction: tx};

            const agencies = await models.Agency.landsThatDay(ctx, 101, today, options);

            expect(agencies.length).toBeGreaterThanOrEqual(3);

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