From 87e4765a1cf5cb4adcd565722c30aa2039d887e4 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Tue, 22 Sep 2020 16:53:47 +0200 Subject: [PATCH] fixed ticket-weekly backend unit test --- .../back/methods/route/specs/updateVolume.spec.js | 1 - .../back/methods/ticket-weekly/specs/filter.spec.js | 10 ++++++---- .../back/methods/ticket/specs/priceDifference.spec.js | 1 - .../back/methods/ticket/specs/setDeleted.spec.js | 2 +- .../methods/ticket/specs/updateEditableTicket.spec.js | 1 - 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/modules/route/back/methods/route/specs/updateVolume.spec.js b/modules/route/back/methods/route/specs/updateVolume.spec.js index a1ff67acc..3b4d51df7 100644 --- a/modules/route/back/methods/route/specs/updateVolume.spec.js +++ b/modules/route/back/methods/route/specs/updateVolume.spec.js @@ -8,7 +8,6 @@ describe('route updateVolume()', () => { let ticketToRestore; let logIdToDestroy; - afterAll(async done => { await originalRoute.updateAttributes({m3: 1.8}); await ticketToRestore.updateAttributes({routeFk: null}); diff --git a/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js b/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js index 14729b094..e600fbfa9 100644 --- a/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js +++ b/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js @@ -2,13 +2,15 @@ const app = require('vn-loopback/server/server'); describe('ticket-weekly filter()', () => { const authUserId = 9; - it('should return the tickets matching the filter', async() => { - const ctx = {req: {accessToken: {userId: authUserId}}, args: {}}; - const filter = {order: 'id DESC'}; - const result = await app.models.TicketWeekly.filter(ctx, filter); + it('should all return the tickets matching the filter', async() => { + const filter = {order: 't.id ASC'}; + const ctx = {req: {accessToken: {userId: authUserId}}, args: {filter: filter}}; + const result = await app.models.TicketWeekly.filter(ctx); + const firstRow = result[0]; expect(firstRow.ticketFk).toEqual(1); + expect(result.length).toEqual(5); }); it('should return the ticket with id one', async() => { diff --git a/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js b/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js index bf61524c7..ea634a499 100644 --- a/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js +++ b/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js @@ -35,7 +35,6 @@ describe('sale priceDifference()', () => { error = e; }); - expect(error).toEqual(new UserError(`The sales of this ticket can't be modified`)); }); }); diff --git a/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js b/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js index 0a73ad322..518b6a4d8 100644 --- a/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js +++ b/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js @@ -25,7 +25,7 @@ describe('ticket setDeleted()', () => { expect(error.message).toEqual('You must delete the claim id %d first'); }); - it('should delete the ticket, remove the stowaway link and change the stowaway ticket state to "FIXING" and get ride of the itemshelving', async() => { + it('should delete the ticket, remove the stowaway link and change the stowaway ticket state to "FIXING" and get rid of the itemshelving', async() => { const employeeUser = 110; const ctx = { req: { diff --git a/modules/ticket/back/methods/ticket/specs/updateEditableTicket.spec.js b/modules/ticket/back/methods/ticket/specs/updateEditableTicket.spec.js index 16d8d1edb..a08565df2 100644 --- a/modules/ticket/back/methods/ticket/specs/updateEditableTicket.spec.js +++ b/modules/ticket/back/methods/ticket/specs/updateEditableTicket.spec.js @@ -26,7 +26,6 @@ describe('ticket updateEditableTicket()', () => { expect(error).toBeDefined(); }); - it('should edit the ticket address', async() => { let ctx = {req: {accessToken: {userId: 9}}};