2022-07-01 07:15:07 +00:00
|
|
|
const models = require('vn-loopback/server/server').models;
|
2019-11-18 11:32:50 +00:00
|
|
|
|
|
|
|
describe('agency getLanded()', () => {
|
2018-08-16 11:12:18 +00:00
|
|
|
it('should return a landing date', async() => {
|
2020-09-23 09:21:25 +00:00
|
|
|
const ctx = {req: {accessToken: {userId: 1}}};
|
2019-07-26 09:48:01 +00:00
|
|
|
const shipped = new Date();
|
2019-11-18 11:32:50 +00:00
|
|
|
shipped.setDate(shipped.getDate() + 1);
|
2019-07-26 09:48:01 +00:00
|
|
|
const addressFk = 121;
|
|
|
|
const agencyModeFk = 7;
|
|
|
|
const warehouseFk = 1;
|
2018-08-16 11:12:18 +00:00
|
|
|
|
2022-07-01 07:15:07 +00:00
|
|
|
const tx = await models.Zone.beginTransaction({});
|
2021-06-18 13:05:03 +00:00
|
|
|
|
|
|
|
try {
|
|
|
|
const options = {transaction: tx};
|
|
|
|
|
2022-07-01 07:15:07 +00:00
|
|
|
const result = await models.Agency.getLanded(ctx, shipped, addressFk, agencyModeFk, warehouseFk, options);
|
2021-06-18 13:05:03 +00:00
|
|
|
|
|
|
|
expect(result.landed).toBeDefined();
|
|
|
|
|
|
|
|
await tx.rollback();
|
|
|
|
} catch (e) {
|
|
|
|
await tx.rollback();
|
|
|
|
throw e;
|
|
|
|
}
|
2018-08-16 11:12:18 +00:00
|
|
|
});
|
|
|
|
});
|