This commit is contained in:
parent
1227f7ac83
commit
2ce442a022
|
@ -1,6 +1,5 @@
|
|||
import ngModule from '../../module';
|
||||
import Component from '../../lib/component';
|
||||
import {focus} from '../../directives/focus';
|
||||
import './style.scss';
|
||||
|
||||
export default class Controller extends Component {
|
||||
|
|
|
@ -91,5 +91,6 @@
|
|||
"NO_ZONE_FOR_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada",
|
||||
"This item doesn't exists": "El artículo no existe",
|
||||
"NOT_ZONE_WITH_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada",
|
||||
"Extension format is invalid": "El formato de la extensión es inválido"
|
||||
"Extension format is invalid": "El formato de la extensión es inválido",
|
||||
"Invalid parameters to create a new ticket": "Parámetros inválidos para crear un nuevo ticket"
|
||||
}
|
|
@ -39,6 +39,9 @@ module.exports = Self => {
|
|||
|
||||
if (!params.receiverTicket.id) {
|
||||
let travelDates = await models.Agency.getFirstShipped(params.currentTicket);
|
||||
|
||||
if (!travelDates)
|
||||
throw new UserError(`Invalid parameters to create a new ticket`);
|
||||
let shipped = new Date(travelDates.shipped);
|
||||
let landed = new Date(travelDates.landed);
|
||||
|
||||
|
|
|
@ -38,6 +38,21 @@ describe('sale moveToTicket()', () => {
|
|||
expect(error).toBeDefined();
|
||||
});
|
||||
|
||||
it('should throw an error when attempting to create a new ticket without delivery dates', async() => {
|
||||
const ctx = {req: {accessToken: {userId: 101}}};
|
||||
let error;
|
||||
|
||||
const params = {currentTicket: {currentTicketId: 18}, receiverTicket: {id: undefined}};
|
||||
|
||||
await app.models.Sale.moveToTicket(ctx, params)
|
||||
.catch(response => {
|
||||
expect(response.message).toEqual(`Invalid parameters to create a new ticket`);
|
||||
error = response;
|
||||
});
|
||||
|
||||
expect(error).toBeDefined();
|
||||
});
|
||||
|
||||
it('should transfer the sales from one ticket to a new one', async() => {
|
||||
const ctx = {req: {accessToken: {userId: 101}}};
|
||||
let currentTicket = await app.models.Ticket.findById(11);
|
||||
|
|
Loading…
Reference in New Issue