Merge pull request 'fix: refs #6005 runtime' (!2401) from 6005-fix-runtime-error into test
gitea/salix/pipeline/head This commit looks good Details
gitea/salix/pipeline/pr-dev This commit looks good Details

Reviewed-on: #2401
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
Pablo Natek 2024-05-03 10:53:51 +00:00
commit 52c9015fca
2 changed files with 11 additions and 14 deletions

View File

@ -52,18 +52,16 @@ describe('Operator', () => {
});
it('should not sent notification when is already notified by another worker', async() => {
try {
await models.NotificationQueue.create({
const {id} = await models.NotificationQueue.create({
authorFk: 2,
notificationFk: notificationName,
params: JSON.stringify({'labelerId': labeler, 'sectorId': sectorId, 'workerId': 2}),
created: '2001-01-01 12:30:00',
created: '2001-01-01 11: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 notificationQueue = await updateOperatorAndFindNotification();
expect(notificationQueue.id).toEqual(id);
});
it('should send a notification when the previous one has distinct params', async() => {

View File

@ -30,8 +30,7 @@ module.exports = Self => {
return Object.keys(criteria).every(key => criteria[key] === paramsObj?.[key]);
});
if (filteredNotifications.length >= 1)
throw new Error('Previous notification sended with the same parameters');
if (filteredNotifications.length >= 1) return;
}
await models.NotificationQueue.create({