2019-05-13 12:34:37 +00:00
|
|
|
const app = 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() => {
|
2021-06-18 13:05:03 +00:00
|
|
|
const tx = await app.models.Agency.beginTransaction({});
|
2019-05-13 12:34:37 +00:00
|
|
|
|
2021-06-18 13:05:03 +00:00
|
|
|
try {
|
|
|
|
const options = {transaction: tx};
|
|
|
|
|
|
|
|
const agencies = await app.models.Agency.landsThatDay(101, today, options);
|
|
|
|
|
|
|
|
expect(agencies.length).toBeGreaterThanOrEqual(3);
|
|
|
|
|
|
|
|
await tx.rollback();
|
|
|
|
} catch (e) {
|
|
|
|
await tx.rollback();
|
|
|
|
throw e;
|
|
|
|
}
|
2019-05-13 12:34:37 +00:00
|
|
|
});
|
|
|
|
});
|