diff --git a/back/methods/notification/specs/send.spec.js b/back/methods/notification/specs/send.spec.js index c506dc4b0..f0b186e06 100644 --- a/back/methods/notification/specs/send.spec.js +++ b/back/methods/notification/specs/send.spec.js @@ -1,38 +1,6 @@ const models = require('vn-loopback/server/server').models; describe('Notification Send()', () => { - beforeAll(async() => { - await models.NotificationQueue.destroyAll(); - await models.NotificationQueue.create( - [ - { - id: 1, - params: '{"id": "1"}', - status: 'pending', - created: '2000-12-31T23:00:00.000Z', - notificationFk: 'print-email', - authorFk: 9 - }, - { - id: 2, - params: '{"id": "2"}', - status: 'pending', - created: '2000-12-31T23:00:00.000Z', - notificationFk: 'print-email', - authorFk: null - }, - { - id: 3, - params: null, - status: 'pending', - created: '2000-12-31T23:00:00.000Z', - notificationFk: 'print-email', - authorFk: null - } - ] - ); - }); - it('should send notification', async() => { const statusPending = 'pending'; const tx = await models.NotificationQueue.beginTransaction({}); diff --git a/modules/worker/back/methods/operator/spec/operator.spec.js b/modules/worker/back/methods/operator/spec/operator.spec.js index cf0b1e4b8..8a7d05298 100644 --- a/modules/worker/back/methods/operator/spec/operator.spec.js +++ b/modules/worker/back/methods/operator/spec/operator.spec.js @@ -8,9 +8,17 @@ describe('Operator', () => { const sentStatus = 'sent'; beforeEach(async() => { - await models.NotificationQueue.destroyAll({notificationFk: notificationName}); + await deleteNotification(); }); + afterAll(async() => { + await deleteNotification(); + }); + + async function deleteNotification() { + await models.NotificationQueue.destroyAll({notificationFk: notificationName}); + } + async function updateOperatorAndFindNotification(labelerFk = labeler) { await models.Operator.updateAll({id: authorFk}, {workerFk: authorFk, labelerFk: labelerFk, sectorFk: sectorId}); return models.NotificationQueue.findOne({order: 'id DESC'});