From f95f977b69a4b72f5122107425f603b113aacae9 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 18 Oct 2022 10:04:53 +0200 Subject: [PATCH] fix: backTest --- .../methods/invoiceOut/specs/globalInvoicing.spec.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/globalInvoicing.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/globalInvoicing.spec.js index bd6a07baa..3f359dfb5 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/specs/globalInvoicing.spec.js +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/globalInvoicing.spec.js @@ -10,7 +10,6 @@ describe('InvoiceOut globalInvoicing()', () => { minShipped.setMonth(1); minShipped.setDate(1); minShipped.setHours(0, 0, 0, 0); - const invoicedTicketId = 8; const invoiceSerial = 'A'; const activeCtx = { accessToken: {userId: userId}, @@ -35,11 +34,14 @@ describe('InvoiceOut globalInvoicing()', () => { companyFk: companyFk, minShipped: minShipped }; - const result = await models.InvoiceOut.globalInvoicing(ctx, options); - const ticket = await models.Ticket.findById(invoicedTicketId, null, options); + const invoiceOutId = await models.InvoiceOut.globalInvoicing(ctx, options); + const invoiceOut = await models.InvoiceOut.findById(invoiceOutId, null, options); + const [firstTicket] = await models.Ticket.find({ + where: {refFk: invoiceOut.ref} + }, options); - expect(result).toBeGreaterThan(0); - expect(ticket.refFk).toContain(invoiceSerial); + expect(invoiceOutId).toBeGreaterThan(0); + expect(firstTicket.refFk).toContain(invoiceSerial); await tx.rollback(); } catch (e) {