diff --git a/services/db/tests/vn/ticketCalculateClon.spec.js b/services/db/tests/vn/ticketCalculateClon.spec.js index 02b82040f..3e1118b37 100644 --- a/services/db/tests/vn/ticketCalculateClon.spec.js +++ b/services/db/tests/vn/ticketCalculateClon.spec.js @@ -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;