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

29 lines
768 B
JavaScript

const app = require(`${servicesDir}/ticket/server/server`);
describe('ticket getShipped()', () => {
it('should return a shipment date', async() => {
let data = {
landed: new Date(),
addressFk: 121,
agencyModeFk: 7
};
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();
});
});