@@ -16,8 +16,10 @@ import Sinon from 'sinon'
1616import { connect , createIdentity , createSubscription , sendEvent } from './helpers'
1717import { getMasterDbClient , getReadReplicaDbClient } from '../../../src/database/client'
1818import { AppWorker } from '../../../src/app/worker'
19+ import { CacheClient } from '../../../src/@types/cache'
1920import { DatabaseClient } from '../../../src/@types/base'
2021import { Event } from '../../../src/@types/event'
22+ import { getCacheClient } from '../../../src/cache/client'
2123import { SettingsStatic } from '../../../src/utils/settings'
2224import { workerFactory } from '../../../src/factories/worker-factory'
2325
@@ -27,6 +29,7 @@ let worker: AppWorker
2729
2830let dbClient : DatabaseClient
2931let rrDbClient : DatabaseClient
32+ let cacheClient : CacheClient
3033
3134export const streams = new WeakMap < WebSocket , Observable < unknown > > ( )
3235
@@ -35,7 +38,9 @@ BeforeAll({ timeout: 1000 }, async function () {
3538 process . env . SECRET = Math . random ( ) . toString ( ) . repeat ( 6 )
3639 dbClient = getMasterDbClient ( )
3740 rrDbClient = getReadReplicaDbClient ( )
41+ cacheClient = getCacheClient ( )
3842 await dbClient . raw ( 'SELECT 1=1' )
43+ await rrDbClient . raw ( 'SELECT 1=1' )
3944 Sinon . stub ( SettingsStatic , 'watchSettings' )
4045 const settings = SettingsStatic . createSettings ( )
4146
@@ -54,7 +59,11 @@ BeforeAll({ timeout: 1000 }, async function () {
5459
5560AfterAll ( async function ( ) {
5661 worker . close ( async ( ) => {
57- await Promise . all ( [ dbClient . destroy ( ) , rrDbClient . destroy ( ) ] )
62+ await Promise . all ( [
63+ dbClient . destroy ( ) ,
64+ rrDbClient . destroy ( ) ,
65+ cacheClient . disconnect ( ) ,
66+ ] )
5867 } )
5968} )
6069
@@ -75,8 +84,6 @@ After(async function () {
7584 }
7685 this . parameters . clients = { }
7786
78- const dbClient = getMasterDbClient ( )
79-
8087 await dbClient ( 'events' )
8188 . whereIn ( 'event_pubkey' , Object
8289 . values ( this . parameters . identities as Record < string , { pubkey : string } > )
0 commit comments