salix/modules/zone/back/methods/agency/specs/landsThatDay.spec.js

23 lines
695 B
JavaScript
Raw Normal View History

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-06-01 06:32:06 +00:00
const ctx = {req: {accessToken: {userId: 9}}};
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
try {
const options = {transaction: tx};
2023-06-01 06:32:06 +00:00
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;
}
2019-05-13 12:34:37 +00:00
});
});