salix/services/loopback/common/methods/ticket/specs/getShipped.spec.js

29 lines
768 B
JavaScript
Raw Normal View History

const app = require(`${servicesDir}/ticket/server/server`);
describe('ticket getShipped()', () => {
2018-08-16 11:12:18 +00:00
it('should return a shipment date', async() => {
let data = {
landed: new Date(),
addressFk: 121,
2018-07-30 13:21:12 +00:00
agencyModeFk: 7
};
2018-08-16 11:12:18 +00:00
let result = await app.models.Ticket.getShipped(data);
expect(result.shipped).toBeDefined();
});
it('should not return a shipment date', async() => {
let newDate = new Date();
newDate.setMonth(newDate.getMonth() - 1);
let data = {
landed: newDate,
addressFk: 121,
agencyModeFk: 7
};
let result = await app.models.Ticket.getShipped(data);
expect(result).toBeUndefined();
});
});