From df38f30f74c071c4adda2ccebe00a44d5b864489 Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 15 Feb 2023 09:10:55 +0100 Subject: [PATCH 1/7] se incluyen los test intermintents que estaban incluidos --- .../invoiceOut/back/methods/invoiceOut/specs/createPdf.spec.js | 1 - .../back/methods/invoiceOut/specs/downloadZip.spec.js | 2 -- 2 files changed, 3 deletions(-) diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/createPdf.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/createPdf.spec.js index 26eae45ac..803338ef3 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/specs/createPdf.spec.js +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/createPdf.spec.js @@ -11,7 +11,6 @@ describe('InvoiceOut createPdf()', () => { const ctx = {req: activeCtx}; it('should create a new PDF file and set true the hasPdf property', async() => { - pending('https://redmine.verdnatura.es/issues/5035'); const invoiceId = 1; spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ active: activeCtx diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/downloadZip.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/downloadZip.spec.js index 0f62a6876..41ea45487 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/specs/downloadZip.spec.js +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/downloadZip.spec.js @@ -30,8 +30,6 @@ describe('InvoiceOut downloadZip()', () => { }); it('should return an error if the size of the files is too large', async() => { - pending('https://redmine.verdnatura.es/issues/5035'); - const tx = await models.InvoiceOut.beginTransaction({}); let error; From 443118a7ac25406993bd6a66e91def9ec28b403d Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 15 Feb 2023 12:37:31 +0100 Subject: [PATCH 2/7] esto se debe BORRAR --- back/tests.js | 4 +++- modules/invoiceOut/back/methods/invoiceOut/createPdf.js | 3 ++- .../invoiceOut/back/methods/invoiceOut/specs/filter.spec.js | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/back/tests.js b/back/tests.js index ab6893791..20118c0e0 100644 --- a/back/tests.js +++ b/back/tests.js @@ -34,6 +34,8 @@ async function test() { const Jasmine = require('jasmine'); const jasmine = new Jasmine(); + jasmine.seed('02137'); + // jasmine.randomizeTests(false); const SpecReporter = require('jasmine-spec-reporter').SpecReporter; jasmine.addReporter(new SpecReporter({ @@ -63,7 +65,7 @@ async function test() { jasmine.loadConfig({ spec_dir: '.', spec_files: backSpecs, - helpers: [], + helpers: [] }); await jasmine.execute(); diff --git a/modules/invoiceOut/back/methods/invoiceOut/createPdf.js b/modules/invoiceOut/back/methods/invoiceOut/createPdf.js index e56516237..18b5e796a 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/createPdf.js +++ b/modules/invoiceOut/back/methods/invoiceOut/createPdf.js @@ -44,7 +44,8 @@ module.exports = Self => { try { const invoiceOut = await Self.findById(id, null, myOptions); const hasInvoicing = await models.Account.hasRole(userId, 'invoicing', myOptions); - + console.log(hasInvoicing); + console.log(invoiceOut); if (invoiceOut.hasPdf && !hasInvoicing) throw new UserError(`You don't have enough privileges`); diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/filter.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/filter.spec.js index d3d789393..15e3e887e 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/specs/filter.spec.js +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/filter.spec.js @@ -66,7 +66,7 @@ describe('InvoiceOut filter()', () => { const result = await models.InvoiceOut.filter(ctx, {id: invoiceOut.id}, options); - expect(result.length).toBeGreaterThanOrEqual(1); + expect(result.length).toEqual(1); await tx.rollback(); } catch (e) { From c69679e204eee44b4ddf352d35ec3667e564d383 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 16 Feb 2023 12:02:36 +0100 Subject: [PATCH 3/7] test --- back/tests.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/tests.js b/back/tests.js index 20118c0e0..28497fd91 100644 --- a/back/tests.js +++ b/back/tests.js @@ -34,7 +34,7 @@ async function test() { const Jasmine = require('jasmine'); const jasmine = new Jasmine(); - jasmine.seed('02137'); + jasmine.seed('68436'); // jasmine.randomizeTests(false); const SpecReporter = require('jasmine-spec-reporter').SpecReporter; From 0b240e7925728dc3c166b71dc132127874bc56de Mon Sep 17 00:00:00 2001 From: vicent Date: Mon, 20 Feb 2023 13:35:50 +0100 Subject: [PATCH 4/7] add console.log --- modules/invoiceOut/back/methods/invoiceOut/createPdf.js | 1 - modules/invoiceOut/back/methods/invoiceOut/specs/filter.spec.js | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/invoiceOut/back/methods/invoiceOut/createPdf.js b/modules/invoiceOut/back/methods/invoiceOut/createPdf.js index 18b5e796a..65eaae657 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/createPdf.js +++ b/modules/invoiceOut/back/methods/invoiceOut/createPdf.js @@ -44,7 +44,6 @@ module.exports = Self => { try { const invoiceOut = await Self.findById(id, null, myOptions); const hasInvoicing = await models.Account.hasRole(userId, 'invoicing', myOptions); - console.log(hasInvoicing); console.log(invoiceOut); if (invoiceOut.hasPdf && !hasInvoicing) throw new UserError(`You don't have enough privileges`); diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/filter.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/filter.spec.js index 15e3e887e..9264bf77d 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/specs/filter.spec.js +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/filter.spec.js @@ -65,6 +65,7 @@ describe('InvoiceOut filter()', () => { await invoiceOut.updateAttribute('hasPdf', true, options); const result = await models.InvoiceOut.filter(ctx, {id: invoiceOut.id}, options); + console.log(result); expect(result.length).toEqual(1); From 7a812551b3aebf5a8932446aa8f6dc2080066496 Mon Sep 17 00:00:00 2001 From: vicent Date: Mon, 20 Feb 2023 13:56:17 +0100 Subject: [PATCH 5/7] delete seed --- back/tests.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/back/tests.js b/back/tests.js index 28497fd91..591548d59 100644 --- a/back/tests.js +++ b/back/tests.js @@ -34,8 +34,7 @@ async function test() { const Jasmine = require('jasmine'); const jasmine = new Jasmine(); - jasmine.seed('68436'); - // jasmine.randomizeTests(false); + // jasmine.seed('68436'); const SpecReporter = require('jasmine-spec-reporter').SpecReporter; jasmine.addReporter(new SpecReporter({ From f6afed485c655f134f535fa9787f52cafd9701dd Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 1 Mar 2023 08:50:30 +0100 Subject: [PATCH 6/7] add console.log --- back/tests.js | 1 - modules/invoiceOut/back/methods/invoiceOut/downloadZip.js | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/back/tests.js b/back/tests.js index 591548d59..5abefd228 100644 --- a/back/tests.js +++ b/back/tests.js @@ -34,7 +34,6 @@ async function test() { const Jasmine = require('jasmine'); const jasmine = new Jasmine(); - // jasmine.seed('68436'); const SpecReporter = require('jasmine-spec-reporter').SpecReporter; jasmine.addReporter(new SpecReporter({ diff --git a/modules/invoiceOut/back/methods/invoiceOut/downloadZip.js b/modules/invoiceOut/back/methods/invoiceOut/downloadZip.js index fe005f1ab..3410baa78 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/downloadZip.js +++ b/modules/invoiceOut/back/methods/invoiceOut/downloadZip.js @@ -47,6 +47,7 @@ module.exports = Self => { ids = ids.split(','); for (let id of ids) { + console.log(zipConfig, totalSize, zipConfig.maxSize); if (zipConfig && totalSize > zipConfig.maxSize) throw new UserError('Files are too large'); const invoiceOutPdf = await models.InvoiceOut.download(ctx, id, myOptions); const fileName = extractFileName(invoiceOutPdf[2]); From 4567981724da22b6c668c10ff4d1c1f8d167aa0c Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 1 Mar 2023 09:09:09 +0100 Subject: [PATCH 7/7] add console.log --- back/tests.js | 2 +- modules/invoiceOut/back/methods/invoiceOut/createPdf.js | 2 +- modules/invoiceOut/back/methods/invoiceOut/downloadZip.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/back/tests.js b/back/tests.js index 5abefd228..ab6893791 100644 --- a/back/tests.js +++ b/back/tests.js @@ -63,7 +63,7 @@ async function test() { jasmine.loadConfig({ spec_dir: '.', spec_files: backSpecs, - helpers: [] + helpers: [], }); await jasmine.execute(); diff --git a/modules/invoiceOut/back/methods/invoiceOut/createPdf.js b/modules/invoiceOut/back/methods/invoiceOut/createPdf.js index 65eaae657..71e7c1543 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/createPdf.js +++ b/modules/invoiceOut/back/methods/invoiceOut/createPdf.js @@ -44,7 +44,7 @@ module.exports = Self => { try { const invoiceOut = await Self.findById(id, null, myOptions); const hasInvoicing = await models.Account.hasRole(userId, 'invoicing', myOptions); - console.log(invoiceOut); + console.log(invoiceOut, !hasInvoicing); if (invoiceOut.hasPdf && !hasInvoicing) throw new UserError(`You don't have enough privileges`); diff --git a/modules/invoiceOut/back/methods/invoiceOut/downloadZip.js b/modules/invoiceOut/back/methods/invoiceOut/downloadZip.js index 3410baa78..208d55358 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/downloadZip.js +++ b/modules/invoiceOut/back/methods/invoiceOut/downloadZip.js @@ -47,7 +47,7 @@ module.exports = Self => { ids = ids.split(','); for (let id of ids) { - console.log(zipConfig, totalSize, zipConfig.maxSize); + console.log(zipConfig, totalSize, zipConfig ? zipConfig.maxSize : null); if (zipConfig && totalSize > zipConfig.maxSize) throw new UserError('Files are too large'); const invoiceOutPdf = await models.InvoiceOut.download(ctx, id, myOptions); const fileName = extractFileName(invoiceOutPdf[2]);