@@ -29,7 +29,7 @@ const rule = {
2929 } ,
3030} as any ;
3131
32- let dbQueryMock = jest . fn ( ( ) => ( {
32+ const dbQueryMock = jest . fn ( ( ) => ( {
3333 notifications : [ rule ] ,
3434} ) ) as any ;
3535
@@ -185,7 +185,7 @@ describe('NotifierWorker', () => {
185185 worker . redis . redisClient . eval = jest . fn ( async ( ) => {
186186 return Promise . resolve ( ) ;
187187 } ) ;
188-
188+
189189 const message = { ...messageMock } ;
190190
191191 await worker . start ( ) ;
@@ -226,15 +226,16 @@ describe('NotifierWorker', () => {
226226 await worker . start ( ) ;
227227
228228 const message = { ...messageMock } ;
229+
229230 message . event . isNew = false ;
230231
231232 jest . mock ( '../src/redisHelper' ) ;
232233
233- RedisHelper . prototype . getEventRepetitionsFromDigest = jest . fn ( async ( _projectId , _groupHash ) => {
234+ RedisHelper . prototype . getEventRepetitionsFromDigest = jest . fn ( async ( ) => {
234235 return Promise . resolve ( 1 ) ;
235236 } ) ;
236237
237- RedisHelper . prototype . getProjectNotificationThreshold = jest . fn ( async ( _projectId ) => {
238+ RedisHelper . prototype . getProjectNotificationThreshold = jest . fn ( async ( ) => {
238239 return Promise . resolve ( 10 ) ;
239240 } ) ;
240241
@@ -248,7 +249,7 @@ describe('NotifierWorker', () => {
248249 */
249250 expect ( worker . sendToSenderWorker ) . not . toBeCalled ( ) ;
250251
251- worker . redis . getEventRepetitionsFromDigest = jest . fn ( async ( _projectId , _groupHash ) => {
252+ worker . redis . getEventRepetitionsFromDigest = jest . fn ( async ( ) => {
252253 return Promise . resolve ( 100 ) ;
253254 } ) ;
254255
@@ -269,12 +270,13 @@ describe('NotifierWorker', () => {
269270 worker . redis . redisClient . eval = jest . fn ( async ( ) => {
270271 return Promise . resolve ( ) ;
271272 } ) ;
272-
273+
273274 worker . getFittedRules = jest . fn ( ) ;
274275
275276 await worker . start ( ) ;
276277
277278 const message = { ...messageMock } ;
279+
278280 message . event . isNew = true ;
279281
280282 await worker . handle ( message ) ;
@@ -295,13 +297,14 @@ describe('NotifierWorker', () => {
295297
296298 const message = { ...messageMock } ;
297299 const event = { ...message . event } ;
300+
298301 event . isNew = false ;
299302
300- worker . redis . getEventRepetitionsFromDigest = jest . fn ( async ( _projectId , _groupHash ) => {
303+ worker . redis . getEventRepetitionsFromDigest = jest . fn ( async ( ) => {
301304 return Promise . resolve ( 10 ) ;
302305 } ) ;
303306
304- worker . redis . getProjectNotificationThreshold = jest . fn ( async ( _projectId ) => {
307+ worker . redis . getProjectNotificationThreshold = jest . fn ( async ( ) => {
305308 return Promise . resolve ( 10 ) ;
306309 } ) ;
307310
@@ -324,15 +327,15 @@ describe('NotifierWorker', () => {
324327 await worker . start ( ) ;
325328
326329 /**
327- * Mock of the function that returns
330+ * Mock of the function that returns
328331 */
329- worker . redis . getEventRepetitionsFromDigest = jest . fn ( async ( _projectId , _groupHash ) => {
332+ worker . redis . getEventRepetitionsFromDigest = jest . fn ( async ( ) => {
330333 return Promise . resolve ( 1 ) ;
331334 } ) ;
332335
333- worker . redis . getProjectNotificationThreshold ( async ( _projectId ) => {
336+ worker . redis . getProjectNotificationThreshold ( async ( ) => {
334337 return Promise . resolve ( 1 ) ;
335- } )
338+ } ) ;
336339
337340 worker . eventsDb . getConnection = jest . fn ( ) ;
338341
@@ -343,7 +346,7 @@ describe('NotifierWorker', () => {
343346 /**
344347 * It should not be called beacuse event repetitions got from redis
345348 */
346- expect ( worker . eventsDb . getConnection ) . not . toBeCalled ;
349+ expect ( worker . eventsDb . getConnection ) . not . toBeCalled ( ) ;
347350
348351 await worker . finish ( ) ;
349352 } ) ;
@@ -354,11 +357,11 @@ describe('NotifierWorker', () => {
354357 worker . redis . redisClient . eval = jest . fn ( async ( ) => {
355358 return Promise . resolve ( ) ;
356359 } ) ;
357-
360+
358361 jest . mock ( '../src/redisHelper' ) ; // Мокируем весь модуль RedisHelper
359362 RedisHelper . prototype . getProjectNotificationThreshold = jest . fn ( ) . mockResolvedValue ( null ) ;
360-
361- worker . eventsDb . getConnection = jest . fn ( ) ;
363+
364+ worker . eventsDb . getConnection = jest . fn ( ) ;
362365
363366 await worker . start ( ) ;
364367
@@ -371,7 +374,7 @@ describe('NotifierWorker', () => {
371374 expect ( worker . eventsDb . getConnection ) . toBeCalled ( ) ;
372375
373376 await worker . finish ( ) ;
374- } )
377+ } ) ;
375378
376379 it ( 'should always add event to redis digest' , async ( ) => {
377380 const worker = new NotifierWorker ( ) ;
0 commit comments