running worker in the test

This commit is contained in:
Hongbo Wu
2024-01-31 17:45:49 +08:00
parent cf898299e4
commit 5e883cb2ba
14 changed files with 152 additions and 155 deletions

View File

@ -1,7 +1,7 @@
import { env } from '../src/env'
import { redisDataSource } from '../src/redis_data_source'
import { createTestConnection } from './db'
import { startApolloServer } from './util'
import { startApolloServer, startWorker } from './util'
export const mochaGlobalSetup = async () => {
await createTestConnection()
@ -10,6 +10,11 @@ export const mochaGlobalSetup = async () => {
if (env.redis.cache.url) {
await redisDataSource.initialize()
console.log('redis connection created')
if (redisDataSource.workerRedisClient) {
startWorker(redisDataSource.workerRedisClient)
console.log('worker started')
}
}
await startApolloServer()