2019-01-24 08:08:28 +00:00
|
|
|
const app = require('vn-loopback/server/server');
|
2018-07-24 10:14:35 +00:00
|
|
|
|
2019-11-18 11:32:50 +00:00
|
|
|
describe('agency getShipped()', () => {
|
2018-08-16 11:12:18 +00:00
|
|
|
it('should return a shipment date', async() => {
|
2019-07-26 09:48:01 +00:00
|
|
|
const landed = new Date();
|
2019-11-18 11:32:50 +00:00
|
|
|
landed.setDate(landed.getDate() + 1);
|
2019-07-26 09:48:01 +00:00
|
|
|
const addressFk = 121;
|
|
|
|
const agencyModeFk = 7;
|
|
|
|
const warehouseFk = 1;
|
|
|
|
|
|
|
|
let result = await app.models.Agency.getShipped(landed, addressFk, agencyModeFk, warehouseFk);
|
2018-08-16 11:12:18 +00:00
|
|
|
|
2019-05-30 06:41:08 +00:00
|
|
|
expect(result).toBeDefined();
|
2018-08-16 11:12:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should not return a shipment date', async() => {
|
|
|
|
let newDate = new Date();
|
|
|
|
newDate.setMonth(newDate.getMonth() - 1);
|
|
|
|
|
2019-07-26 09:48:01 +00:00
|
|
|
const landed = newDate;
|
|
|
|
const addressFk = 121;
|
|
|
|
const agencyModeFk = 7;
|
|
|
|
const warehouseFk = 1;
|
|
|
|
|
|
|
|
let result = await app.models.Agency.getShipped(landed, addressFk, agencyModeFk, warehouseFk);
|
2018-08-16 11:12:18 +00:00
|
|
|
|
2019-07-26 09:48:01 +00:00
|
|
|
expect(result).toBeUndefined();
|
2018-07-24 10:14:35 +00:00
|
|
|
});
|
|
|
|
});
|