fix: backTest

This commit is contained in:
Vicent Llopis 2022-10-17 11:53:29 +02:00
parent dd10b79441
commit 2d1b48280c
1 changed files with 9 additions and 4 deletions

View File

@ -2,9 +2,14 @@ const models = require('vn-loopback/server/server').models;
describe('InvoiceOut globalInvoicing()', () => { describe('InvoiceOut globalInvoicing()', () => {
const userId = 1; const userId = 1;
const companyFk = 442;
const clientId = 1101; 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 invoicedTicketId = 8;
const invoiceSerial = 'A'; const invoiceSerial = 'A';
const activeCtx = { const activeCtx = {
@ -28,12 +33,12 @@ describe('InvoiceOut globalInvoicing()', () => {
invoiceDate: new Date(), invoiceDate: new Date(),
maxShipped: new Date(), maxShipped: new Date(),
companyFk: companyFk, companyFk: companyFk,
minShipped: new Date() minShipped: minShipped
}; };
const result = await models.InvoiceOut.globalInvoicing(ctx, options); const result = await models.InvoiceOut.globalInvoicing(ctx, options);
const ticket = await models.Ticket.findById(invoicedTicketId, null, options); const ticket = await models.Ticket.findById(invoicedTicketId, null, options);
expect(result.length).toBeGreaterThan(0); expect(result).toBeGreaterThan(0);
expect(ticket.refFk).toContain(invoiceSerial); expect(ticket.refFk).toContain(invoiceSerial);
await tx.rollback(); await tx.rollback();