diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/globalInvoicing.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/globalInvoicing.spec.js index eeef08e1f..bd6a07baa 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();