params are now defined for future maintenance

This commit is contained in:
Carlos Jimenez 2018-10-08 14:13:18 +02:00
parent 979660dac3
commit 6283f31f5a
1 changed files with 46 additions and 20 deletions

View File

@ -3,6 +3,19 @@ const app = require(`../../../ticket/server/server`);
describe('ticket ticketCalculateClon()', () => {
const today = new Date();
it('should add the ticket to the order containing the original ticket', async() => {
let params = {
clientFk: 101,
shipped: today,
warehouseFk: 1,
companyFk: 442,
addressFk: 121,
agencyType: 23,
routeFk: 1,
landed: today,
userId: 21,
originalTicketId: 11
};
let query = `
START TRANSACTION;
CALL vn.ticketCreateWithUser(?, ?, ?, ?, ?, ?, ?, ?, ?, @result);
@ -11,16 +24,16 @@ describe('ticket ticketCalculateClon()', () => {
SELECT * FROM tmp.agencyHourGetShipped;
ROLLBACK;`;
let result = await app.models.Ticket.rawSql(query, [
101,
today,
1,
442,
121,
23,
1,
today,
21,
11
params.clientFk,
params.shipped,
params.warehouseFk,
params.companyFk,
params.addressFk,
params.agencyType,
params.routeFk,
params.landed,
params.userId,
params.originalTicketId
]);
let expectedOrder = 11;
@ -34,6 +47,19 @@ describe('ticket ticketCalculateClon()', () => {
});
it('should add the ticket to the order containing the original ticket and generate landed value if it was null', async() => {
let params = {
clientFk: 101,
shipped: today,
warehouseFk: 1,
companyFk: 442,
addressFk: 121,
agencyType: 23,
routeFk: 1,
landed: null,
userId: 21,
originalTicketId: 11
};
let query = `
START TRANSACTION;
CALL vn.ticketCreateWithUser(?, ?, ?, ?, ?, ?, ?, ?, ?, @result);
@ -42,16 +68,16 @@ describe('ticket ticketCalculateClon()', () => {
SELECT * FROM tmp.agencyHourGetShipped;
ROLLBACK;`;
let result = await app.models.Ticket.rawSql(query, [
101,
today,
1,
442,
121,
23,
1,
null,
21,
11
params.clientFk,
params.shipped,
params.warehouseFk,
params.companyFk,
params.addressFk,
params.agencyType,
params.routeFk,
params.landed,
params.userId,
params.originalTicketId
]);
let expectedOrder = 11;