@@ -27,6 +27,7 @@ const redisMock = {
27
27
lrange : ( ) => jest . fn ( ) ,
28
28
disconnect : ( ) => jest . fn ( ) ,
29
29
expire : ( ) => jest . fn ( ) ,
30
+ unlink : ( ) => jest . fn ( ) ,
30
31
} as unknown as Redis
31
32
32
33
const simpleModuleOptions = { redisUrl : "test-url" }
@@ -63,7 +64,7 @@ describe("RedisEventBusService", () => {
63
64
{
64
65
connection : expect . any ( Object ) ,
65
66
prefix : "RedisEventBusService" ,
66
- autorun : false
67
+ autorun : false ,
67
68
}
68
69
)
69
70
} )
@@ -269,15 +270,15 @@ describe("RedisEventBusService", () => {
269
270
} ,
270
271
]
271
272
272
- redis . del = jest . fn ( )
273
+ redis . unlink = jest . fn ( )
273
274
274
275
await eventBus . emit ( events , options )
275
276
276
277
// Expect 1 event to have been send
277
278
// Expect 2 pushes to redis as there are 2 groups of events to push
278
279
expect ( queue . addBulk ) . toHaveBeenCalledTimes ( 1 )
279
280
expect ( redis . rpush ) . toHaveBeenCalledTimes ( 2 )
280
- expect ( redis . del ) . not . toHaveBeenCalled ( )
281
+ expect ( redis . unlink ) . not . toHaveBeenCalled ( )
281
282
282
283
const [ testGroup1Event ] = ( eventBus as any ) . buildEvents (
283
284
[ events [ 0 ] ] ,
@@ -314,12 +315,12 @@ describe("RedisEventBusService", () => {
314
315
315
316
expect ( queue . addBulk ) . toHaveBeenCalledTimes ( 1 )
316
317
expect ( queue . addBulk ) . toHaveBeenCalledWith ( [ testGroup1Event ] )
317
- expect ( redis . del ) . toHaveBeenCalledTimes ( 1 )
318
- expect ( redis . del ) . toHaveBeenCalledWith ( "staging:test-group-1" )
318
+ expect ( redis . unlink ) . toHaveBeenCalledTimes ( 1 )
319
+ expect ( redis . unlink ) . toHaveBeenCalledWith ( "staging:test-group-1" )
319
320
320
321
queue = ( eventBus as any ) . queue_
321
322
queue . addBulk = jest . fn ( )
322
- redis . del = jest . fn ( )
323
+ redis . unlink = jest . fn ( )
323
324
324
325
await eventBus . releaseGroupedEvents ( "test-group-2" )
325
326
@@ -328,8 +329,8 @@ describe("RedisEventBusService", () => {
328
329
testGroup2Event ,
329
330
testGroup2Event2 ,
330
331
] )
331
- expect ( redis . del ) . toHaveBeenCalledTimes ( 1 )
332
- expect ( redis . del ) . toHaveBeenCalledWith ( "staging:test-group-2" )
332
+ expect ( redis . unlink ) . toHaveBeenCalledTimes ( 1 )
333
+ expect ( redis . unlink ) . toHaveBeenCalledWith ( "staging:test-group-2" )
333
334
} )
334
335
} )
335
336
} )
0 commit comments