From 2d1b48280c58b8f0c626ae9b0e611ef5e814dd13 Mon Sep 17 00:00:00 2001 From: vicent Date: Mon, 17 Oct 2022 11:53:29 +0200 Subject: [PATCH] fix: backTest --- .../invoiceOut/specs/globalInvoicing.spec.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/globalInvoicing.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/globalInvoicing.spec.js index eeef08e1ff..bd6a07baa7 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/specs/globalInvoicing.spec.js +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/globalInvoicing.spec.js @@ -2,9 +2,14 @@ const models = require('vn-loopback/server/server').models; describe('InvoiceOut globalInvoicing()', () => { const userId = 1; - const companyFk = 442; const clientId = 1101; - const addressId = 1; + const addressId = 121; + const companyFk = 442; + const minShipped = new Date(); + minShipped.setFullYear(minShipped.getFullYear() - 1); + minShipped.setMonth(1); + minShipped.setDate(1); + minShipped.setHours(0, 0, 0, 0); const invoicedTicketId = 8; const invoiceSerial = 'A'; const activeCtx = { @@ -28,12 +33,12 @@ describe('InvoiceOut globalInvoicing()', () => { invoiceDate: new Date(), maxShipped: new Date(), companyFk: companyFk, - minShipped: new Date() + minShipped: minShipped }; const result = await models.InvoiceOut.globalInvoicing(ctx, options); const ticket = await models.Ticket.findById(invoicedTicketId, null, options); - expect(result.length).toBeGreaterThan(0); + expect(result).toBeGreaterThan(0); expect(ticket.refFk).toContain(invoiceSerial); await tx.rollback();