From 9fc7a132bacde2be0853964e8c384e239eed5461 Mon Sep 17 00:00:00 2001 From: Saad Jutt Date: Wed, 20 Apr 2022 00:06:21 +0500 Subject: [PATCH] test: fixed unhandled timout --- api/src/app.ts | 2 +- api/src/utils/connectDB.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/src/app.ts b/api/src/app.ts index 77c3380..100b529 100644 --- a/api/src/app.ts +++ b/api/src/app.ts @@ -59,6 +59,6 @@ export default setProcessVariables().then(async () => { app.use(onError) - connectDB() + await connectDB() return app }) diff --git a/api/src/utils/connectDB.ts b/api/src/utils/connectDB.ts index 7709b49..ea52cbe 100644 --- a/api/src/utils/connectDB.ts +++ b/api/src/utils/connectDB.ts @@ -2,7 +2,7 @@ import mongoose from 'mongoose' import { populateClients } from '../routes/api/auth' import { seedDB } from './seedDB' -export const connectDB = () => { +export const connectDB = async () => { // NOTE: when exporting app.js as agent for supertest // we should exclude connecting to the real database if (process.env.NODE_ENV === 'test') {