This commit is contained in:
parent
c3f5b2c4dd
commit
1336bf092d
|
@ -332,9 +332,9 @@ INSERT INTO `vn`.`observationType`(`id`,`description`)
|
|||
|
||||
INSERT INTO `vn`.`addressObservation`(`id`,`addressFk`,`observationTypeFk`,`description`)
|
||||
VALUES
|
||||
(1, 1, 1, 'under the floor'),
|
||||
(2, 1, 2, 'wears leather and goes out at night'),
|
||||
(3, 1, 3, 'care with the dog');
|
||||
(1, 121, 1, 'under the floor'),
|
||||
(2, 121, 2, 'wears leather and goes out at night'),
|
||||
(3, 121, 3, 'care with the dog');
|
||||
|
||||
INSERT INTO `vn`.`creditClassification`(`id`, `client`, `dateStart`, `dateEnd`)
|
||||
VALUES
|
||||
|
|
|
@ -20,21 +20,27 @@ describe('last_buy_refresh()', () => {
|
|||
|
||||
let lastBuyTable = result[lastBuyTableIndex];
|
||||
|
||||
expect(lastBuyTable.length).toEqual(4);
|
||||
expect(lastBuyTable.length).toEqual(6);
|
||||
|
||||
expect(lastBuyTable[0].item_id).toEqual(1);
|
||||
expect(lastBuyTable[1].item_id).toEqual(2);
|
||||
expect(lastBuyTable[2].item_id).toEqual(3);
|
||||
expect(lastBuyTable[3].item_id).toEqual(4);
|
||||
expect(lastBuyTable[4].item_id).toEqual(8);
|
||||
expect(lastBuyTable[5].item_id).toEqual(9);
|
||||
|
||||
expect(lastBuyTable[0].warehouse_id).toEqual(1);
|
||||
expect(lastBuyTable[1].warehouse_id).toEqual(1);
|
||||
expect(lastBuyTable[2].warehouse_id).toEqual(1);
|
||||
expect(lastBuyTable[3].warehouse_id).toEqual(1);
|
||||
expect(lastBuyTable[4].warehouse_id).toEqual(1);
|
||||
expect(lastBuyTable[5].warehouse_id).toEqual(1);
|
||||
|
||||
expect(lastBuyTable[1].buy_id).toEqual(4);
|
||||
expect(lastBuyTable[0].buy_id).toEqual(3);
|
||||
expect(lastBuyTable[2].buy_id).toEqual(5);
|
||||
expect(lastBuyTable[3].buy_id).toEqual(6);
|
||||
expect(lastBuyTable[3].buy_id).toEqual(8);
|
||||
expect(lastBuyTable[4].buy_id).toEqual(6);
|
||||
expect(lastBuyTable[5].buy_id).toEqual(7);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -29,21 +29,27 @@ describe('buyUltimate()', () => {
|
|||
|
||||
let buyUltimateTable = result[buyUltimateTableIndex];
|
||||
|
||||
expect(buyUltimateTable.length).toEqual(4);
|
||||
expect(buyUltimateTable.length).toEqual(6);
|
||||
|
||||
expect(buyUltimateTable[0].itemFk).toEqual(1);
|
||||
expect(buyUltimateTable[1].itemFk).toEqual(2);
|
||||
expect(buyUltimateTable[2].itemFk).toEqual(3);
|
||||
expect(buyUltimateTable[3].itemFk).toEqual(4);
|
||||
expect(buyUltimateTable[4].itemFk).toEqual(8);
|
||||
expect(buyUltimateTable[5].itemFk).toEqual(9);
|
||||
|
||||
expect(buyUltimateTable[0].warehouseFk).toEqual(1);
|
||||
expect(buyUltimateTable[1].warehouseFk).toEqual(1);
|
||||
expect(buyUltimateTable[2].warehouseFk).toEqual(1);
|
||||
expect(buyUltimateTable[3].warehouseFk).toEqual(1);
|
||||
expect(buyUltimateTable[4].warehouseFk).toEqual(1);
|
||||
expect(buyUltimateTable[5].warehouseFk).toEqual(1);
|
||||
|
||||
expect(buyUltimateTable[1].buyFk).toEqual(4);
|
||||
expect(buyUltimateTable[0].buyFk).toEqual(3);
|
||||
expect(buyUltimateTable[2].buyFk).toEqual(5);
|
||||
expect(buyUltimateTable[3].buyFk).toEqual(6);
|
||||
expect(buyUltimateTable[3].buyFk).toEqual(8);
|
||||
expect(buyUltimateTable[4].buyFk).toEqual(6);
|
||||
expect(buyUltimateTable[5].buyFk).toEqual(7);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -86,18 +86,20 @@ describe('ticket ticketCalculateClon()', () => {
|
|||
|
||||
stmt = new ParameterizedSQL('CALL vn.ticketCalculateClon(@result, ?)', [params.originalTicketId]);
|
||||
stmts.push(stmt);
|
||||
|
||||
let orderIndex = stmts.push(`SELECT * FROM vn.orderTicket WHERE ticketFk = @result`) - 1;
|
||||
|
||||
stmts.push('ROLLBACK');
|
||||
|
||||
let sql = ParameterizedSQL.join(stmts, ';');
|
||||
let result = await app.models.Ticket.rawStmt(sql);
|
||||
|
||||
let expectedOrder = 11;
|
||||
let newestTicketIdInFixtures = 21;
|
||||
let error;
|
||||
|
||||
expect(result[orderIndex][0].orderFk).toEqual(expectedOrder);
|
||||
expect(result[orderIndex][0].ticketFk).toBeGreaterThan(newestTicketIdInFixtures);
|
||||
try {
|
||||
await app.models.Ticket.rawStmt(sql);
|
||||
} catch (e) {
|
||||
error = e;
|
||||
}
|
||||
|
||||
expect(error).toBeDefined();
|
||||
expect(error.statusCode).toBe(500);
|
||||
expect(error.code).toBe('ER_SIGNAL_EXCEPTION');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -14,8 +14,8 @@ describe('ticket ticketCreateWithUser()', () => {
|
|||
shipped: today,
|
||||
warehouseFk: 1,
|
||||
companyFk: 442,
|
||||
addressFk: 1,
|
||||
agencyModeFk: 2,
|
||||
addressFk: 121,
|
||||
agencyModeFk: 1,
|
||||
routeFk: null,
|
||||
landed: today,
|
||||
userId: 18
|
||||
|
@ -64,8 +64,8 @@ describe('ticket ticketCreateWithUser()', () => {
|
|||
shipped: today,
|
||||
warehouseFk: 1,
|
||||
companyFk: 442,
|
||||
addressFk: 1,
|
||||
agencyModeFk: 2,
|
||||
addressFk: 121,
|
||||
agencyModeFk: 1,
|
||||
routeFk: null,
|
||||
landed: today,
|
||||
userId: 18
|
||||
|
@ -91,7 +91,6 @@ describe('ticket ticketCreateWithUser()', () => {
|
|||
let sql = ParameterizedSQL.join(stmts, ';');
|
||||
let result = await app.models.Ticket.rawStmt(sql);
|
||||
|
||||
|
||||
let firstTicketObservation = result[ticketObsevationsIndex][0];
|
||||
let secondTicketObservation = result[ticketObsevationsIndex][1];
|
||||
let thirdTicketObservation = result[ticketObsevationsIndex][2];
|
||||
|
@ -116,7 +115,7 @@ describe('ticket ticketCreateWithUser()', () => {
|
|||
warehouseFk: 1,
|
||||
companyFk: 442,
|
||||
addressFk: 0,
|
||||
agencyModeFk: 2,
|
||||
agencyModeFk: 1,
|
||||
routeFk: null,
|
||||
landed: today,
|
||||
userId: 18
|
||||
|
@ -162,8 +161,8 @@ describe('ticket ticketCreateWithUser()', () => {
|
|||
shipped: today,
|
||||
warehouseFk: 1,
|
||||
companyFk: 442,
|
||||
addressFk: 0,
|
||||
agencyModeFk: 2,
|
||||
addressFk: 121,
|
||||
agencyModeFk: 1,
|
||||
routeFk: null,
|
||||
landed: today,
|
||||
userId: 18
|
||||
|
@ -186,7 +185,8 @@ describe('ticket ticketCreateWithUser()', () => {
|
|||
params.userId
|
||||
]);
|
||||
stmts.push(stmt);
|
||||
|
||||
let ticket = stmts.push(`select @newTicketId`);
|
||||
console.log('NUm ticket', ticket);
|
||||
let ticketStateCodeIndex = stmts.push(`SELECT code FROM vn.ticketState WHERE ticketFk = @newTicketId`) - 1;
|
||||
|
||||
stmts.push('ROLLBACK');
|
||||
|
@ -196,6 +196,6 @@ describe('ticket ticketCreateWithUser()', () => {
|
|||
|
||||
let ticketStateCode = result[ticketStateCodeIndex][0].code;
|
||||
|
||||
expect(ticketStateCode).toEqual('DELIVERED');
|
||||
expect(ticketStateCode).toEqual('FREE');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -31,7 +31,7 @@ describe('claimBeginning', () => {
|
|||
expect(refundTicketSales.length).toEqual(2);
|
||||
expect(refundTicketSales[0].quantity).toEqual(-5);
|
||||
expect(refundTicketSales[1].quantity).toEqual(-4);
|
||||
expect(refundTicketObservations[0].description).toEqual('Reclama ticket: 11');
|
||||
expect(refundTicketObservations[3].description).toEqual('Reclama ticket: 11');
|
||||
expect(refundTicketState.stateFk).toEqual(16);
|
||||
expect(salesInsertedInClaimEnd[0].saleFk).toEqual(refundTicketSales[0].id);
|
||||
expect(salesInsertedInClaimEnd[1].saleFk).toEqual(refundTicketSales[1].id);
|
||||
|
|
Loading…
Reference in New Issue