From 29af7cfcbcf8af057cd0c5a1ed9c6263d34fc56c Mon Sep 17 00:00:00 2001 From: jtubau Date: Mon, 27 Jan 2025 08:23:30 +0100 Subject: [PATCH] test: refs #7322 added test error for case when expected error is not thrown --- modules/ticket/back/methods/ticket/specs/transferClient.spec.js | 1 + modules/ticket/back/methods/ticket/transferClient.js | 1 + 2 files changed, 2 insertions(+) diff --git a/modules/ticket/back/methods/ticket/specs/transferClient.spec.js b/modules/ticket/back/methods/ticket/specs/transferClient.spec.js index 327a099d8..063433680 100644 --- a/modules/ticket/back/methods/ticket/specs/transferClient.spec.js +++ b/modules/ticket/back/methods/ticket/specs/transferClient.spec.js @@ -92,6 +92,7 @@ describe('Ticket transferClient()', () => { const addressFk = 1; try { await models.Ticket.transferClient(ctx, originalTicketId, clientId, addressFk, options); + fail('Expected an error to be thrown, but none was thrown.'); } catch (e) { expect(e.message).toEqual('The address does not belong to the client'); } diff --git a/modules/ticket/back/methods/ticket/transferClient.js b/modules/ticket/back/methods/ticket/transferClient.js index 76a66c528..2e845144e 100644 --- a/modules/ticket/back/methods/ticket/transferClient.js +++ b/modules/ticket/back/methods/ticket/transferClient.js @@ -1,3 +1,4 @@ +const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('transferClient', { description: 'Transferring ticket to another client',