fix tests

This commit is contained in:
Hongbo Wu
2024-01-04 22:27:31 +08:00
parent 32a58e49f9
commit f4ff4b9fcd
2 changed files with 14 additions and 0 deletions

View File

@ -1,3 +1,5 @@
import { env } from '../src/env'
import { redisClient } from '../src/redis'
import { createTestConnection } from './db'
import { startApolloServer } from './util'
@ -5,6 +7,11 @@ export const mochaGlobalSetup = async () => {
await createTestConnection()
console.log('db connection created')
if (env.redis.url) {
await redisClient.connect()
console.log('redis connection created')
}
await startApolloServer()
console.log('apollo server started')
}

View File

@ -1,4 +1,6 @@
import { appDataSource } from '../src/data_source'
import { env } from '../src/env'
import { redisClient } from '../src/redis'
import { stopApolloServer } from './util'
export const mochaGlobalTeardown = async () => {
@ -7,4 +9,9 @@ export const mochaGlobalTeardown = async () => {
await appDataSource.destroy()
console.log('db connection closed')
if (env.redis.url) {
await redisClient.disconnect()
console.log('redis connection closed')
}
}