2023-01-24 08:04:43 +00:00
|
|
|
const {models} = require('vn-loopback/server/server');
|
2019-11-18 11:32:50 +00:00
|
|
|
|
|
|
|
describe('Agency landsThatDay()', () => {
|
2023-01-16 14:18:24 +00:00
|
|
|
const today = Date.vnNew();
|
2019-05-13 12:34:37 +00:00
|
|
|
it('should return a list of agencies that can land a shipment on a day for an address', async() => {
|
2023-01-24 08:04:43 +00:00
|
|
|
const tx = await models.Agency.beginTransaction({});
|
2019-05-13 12:34:37 +00:00
|
|
|
|
2021-06-18 13:05:03 +00:00
|
|
|
try {
|
|
|
|
const options = {transaction: tx};
|
|
|
|
|
2023-01-24 08:04:43 +00:00
|
|
|
const agencies = await models.Agency.landsThatDay(101, today, options);
|
2021-06-18 13:05:03 +00:00
|
|
|
|
|
|
|
expect(agencies.length).toBeGreaterThanOrEqual(3);
|
|
|
|
|
|
|
|
await tx.rollback();
|
|
|
|
} catch (e) {
|
|
|
|
await tx.rollback();
|
|
|
|
throw e;
|
|
|
|
}
|
2019-05-13 12:34:37 +00:00
|
|
|
});
|
|
|
|
});
|