From 3ae192c7611130434991179827ff900890454cbc Mon Sep 17 00:00:00 2001 From: pablone Date: Fri, 3 May 2024 12:52:12 +0200 Subject: [PATCH] fix: refs #6005 fix test --- .../methods/operator/spec/operator.spec.js | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/modules/worker/back/methods/operator/spec/operator.spec.js b/modules/worker/back/methods/operator/spec/operator.spec.js index 8a7d05298..c80a6542d 100644 --- a/modules/worker/back/methods/operator/spec/operator.spec.js +++ b/modules/worker/back/methods/operator/spec/operator.spec.js @@ -52,18 +52,16 @@ describe('Operator', () => { }); it('should not sent notification when is already notified by another worker', async() => { - try { - await models.NotificationQueue.create({ - authorFk: 2, - notificationFk: notificationName, - params: JSON.stringify({'labelerId': labeler, 'sectorId': sectorId, 'workerId': 2}), - created: '2001-01-01 12:30:00', - status: sentStatus - }); - await models.Operator.updateAll({id: 1}, {labelerFk: labeler, sectorFk: sectorId}); - } catch (e) { - expect(e.message).toEqual('Previous notification sended with the same parameters'); - } + const {id} = await models.NotificationQueue.create({ + authorFk: 2, + notificationFk: notificationName, + params: JSON.stringify({'labelerId': labeler, 'sectorId': sectorId, 'workerId': 2}), + created: '2001-01-01 11:30:00', + status: sentStatus + }); + const notificationQueue = await updateOperatorAndFindNotification(); + + expect(notificationQueue.id).toEqual(id); }); it('should send a notification when the previous one has distinct params', async() => {