mirror of
https://github.com/Cameri/nostream.git
synced 2025-05-31 18:19:13 +02:00
chore: fix intg tests not closing
This commit is contained in:
parent
d9e402060d
commit
acdb08091a
@ -16,8 +16,10 @@ import Sinon from 'sinon'
|
||||
import { connect, createIdentity, createSubscription, sendEvent } from './helpers'
|
||||
import { getMasterDbClient, getReadReplicaDbClient } from '../../../src/database/client'
|
||||
import { AppWorker } from '../../../src/app/worker'
|
||||
import { CacheClient } from '../../../src/@types/cache'
|
||||
import { DatabaseClient } from '../../../src/@types/base'
|
||||
import { Event } from '../../../src/@types/event'
|
||||
import { getCacheClient } from '../../../src/cache/client'
|
||||
import { SettingsStatic } from '../../../src/utils/settings'
|
||||
import { workerFactory } from '../../../src/factories/worker-factory'
|
||||
|
||||
@ -27,6 +29,7 @@ let worker: AppWorker
|
||||
|
||||
let dbClient: DatabaseClient
|
||||
let rrDbClient: DatabaseClient
|
||||
let cacheClient: CacheClient
|
||||
|
||||
export const streams = new WeakMap<WebSocket, Observable<unknown>>()
|
||||
|
||||
@ -35,7 +38,9 @@ BeforeAll({ timeout: 1000 }, async function () {
|
||||
process.env.SECRET = Math.random().toString().repeat(6)
|
||||
dbClient = getMasterDbClient()
|
||||
rrDbClient = getReadReplicaDbClient()
|
||||
cacheClient = getCacheClient()
|
||||
await dbClient.raw('SELECT 1=1')
|
||||
await rrDbClient.raw('SELECT 1=1')
|
||||
Sinon.stub(SettingsStatic, 'watchSettings')
|
||||
const settings = SettingsStatic.createSettings()
|
||||
|
||||
@ -54,7 +59,11 @@ BeforeAll({ timeout: 1000 }, async function () {
|
||||
|
||||
AfterAll(async function() {
|
||||
worker.close(async () => {
|
||||
await Promise.all([dbClient.destroy(), rrDbClient.destroy()])
|
||||
await Promise.all([
|
||||
dbClient.destroy(),
|
||||
rrDbClient.destroy(),
|
||||
cacheClient.disconnect(),
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
@ -75,8 +84,6 @@ After(async function () {
|
||||
}
|
||||
this.parameters.clients = {}
|
||||
|
||||
const dbClient = getMasterDbClient()
|
||||
|
||||
await dbClient('events')
|
||||
.whereIn('event_pubkey', Object
|
||||
.values(this.parameters.identities as Record<string, { pubkey: string }>)
|
||||
|
Loading…
x
Reference in New Issue
Block a user