From d39d54a514aa85c493175b39cc10486964cc6d56 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 30 Jan 2024 09:50:53 +0100 Subject: [PATCH] fix: #6184 Requested changes --- .../back/methods/route/specs/downloadCmrsZip.spec.js | 11 +++++++++-- .../route/back/methods/route/specs/saveCmr.spec.js | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/route/back/methods/route/specs/downloadCmrsZip.spec.js b/modules/route/back/methods/route/specs/downloadCmrsZip.spec.js index 1e8ed29e7..c6b498a77 100644 --- a/modules/route/back/methods/route/specs/downloadCmrsZip.spec.js +++ b/modules/route/back/methods/route/specs/downloadCmrsZip.spec.js @@ -6,6 +6,7 @@ describe('route downloadCmrsZip()', () => { }); it('should create a zip file with the given cmr ids', async() => { + const tx = await models.Route.beginTransaction({}); const ctx = { req: { getLocale: () => { @@ -15,8 +16,14 @@ describe('route downloadCmrsZip()', () => { } }; let cmrs = '1,2'; - let result = await models.Route.downloadCmrsZip(ctx, cmrs); + try { + await models.Route.downloadCmrsZip(ctx, cmrs); + await tx.rollback(); + } catch (e) { + error = e; + await tx.rollback(); + } - expect(result.length).toBeGreaterThanOrEqual(1); + expect(error).toBeDefined(); }); }); diff --git a/modules/route/back/methods/route/specs/saveCmr.spec.js b/modules/route/back/methods/route/specs/saveCmr.spec.js index 9de29540f..d9ad12ad1 100644 --- a/modules/route/back/methods/route/specs/saveCmr.spec.js +++ b/modules/route/back/methods/route/specs/saveCmr.spec.js @@ -1,6 +1,6 @@ const models = require('vn-loopback/server/server').models; -describe('Ticket saveCmr()', () => { +describe('ticket saveCmr()', () => { let ctx = {req: { accessToken: {userId: 9} }};