From 1766222c126c895b87461c68770f65ece4fbbc72 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 26 Apr 2022 13:25:12 +0200 Subject: [PATCH] refactor: updated backTest --- .../back/methods/sale/specs/refund.spec.js | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/modules/ticket/back/methods/sale/specs/refund.spec.js b/modules/ticket/back/methods/sale/specs/refund.spec.js index 40fd6c17ea..5cb353055a 100644 --- a/modules/ticket/back/methods/sale/specs/refund.spec.js +++ b/modules/ticket/back/methods/sale/specs/refund.spec.js @@ -1,20 +1,20 @@ const models = require('vn-loopback/server/server').models; describe('sale refund()', () => { + const sales = [ + {id: 7, ticketFk: 11}, + {id: 8, ticketFk: 11} + ]; + const services = [{id: 1}]; + it('should create ticket with the selected lines changing the sign to the quantites', async() => { const tx = await models.Sale.beginTransaction({}); const ctx = {req: {accessToken: {userId: 9}}}; - const ticketId = 11; - const sales = [ - {id: 7, ticketFk: 11}, - {id: 8, ticketFk: 11} - ]; - try { const options = {transaction: tx}; - const response = await models.Sale.refund(ctx, sales, ticketId, options); + const response = await models.Sale.refund(ctx, sales, services, options); const [newTicketId] = await models.Sale.rawSql('SELECT MAX(t.id) id FROM vn.ticket t;', null, options); expect(response).toEqual(newTicketId.id); @@ -30,17 +30,12 @@ describe('sale refund()', () => { const tx = await models.Sale.beginTransaction({}); const ctx = {req: {accessToken: {userId: 1}}}; - const ticketId = 11; - const sales = [ - {id: 7, ticketFk: 11} - ]; - let error; try { const options = {transaction: tx}; - await models.Sale.refund(ctx, sales, ticketId, options); + await models.Sale.refund(ctx, sales, services, options); await tx.rollback(); } catch (e) {