From aff45d1503a777a4ce7e07836e7acbacc15938fd Mon Sep 17 00:00:00 2001 From: Mohamed Meabed Date: Thu, 2 Nov 2023 15:10:36 -0400 Subject: [PATCH] chore: update mongoose --- src/__mocks__/mongooseCommon.ts | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/__mocks__/mongooseCommon.ts b/src/__mocks__/mongooseCommon.ts index 1d97a656..90a73576 100644 --- a/src/__mocks__/mongooseCommon.ts +++ b/src/__mocks__/mongooseCommon.ts @@ -1,10 +1,8 @@ /* eslint-disable no-param-reassign, no-console */ -import mongoose, { version } from 'mongoose'; +import mongoose from 'mongoose'; import MongoMemoryServer from 'mongodb-memory-server-core'; -const versionNumber = Number(version.charAt(0)); - const { Schema, Types } = mongoose; mongoose.Promise = Promise; @@ -14,17 +12,7 @@ mongoose.createConnection = (async () => { const mongoServer = await MongoMemoryServer.create(); const mongoUri = mongoServer.getUri(); - // originalConnect.bind(mongoose)(mongoUri, { useMongoClient: true }); // mongoose 4 - originalConnect.bind(mongoose)( - mongoUri, - versionNumber > 7 - ? {} - : ({ - useNewUrlParser: true, - useUnifiedTopology: true, - } as any) /* for tests compatibility with mongoose v5 & v6 */ - ); // mongoose 5 - // originalConnect.bind(mongoose)(mongoUri, {}); // mongoose 6 + originalConnect.bind(mongoose)(mongoUri, {}); mongoose.connection.on('error', (e) => { if (e.message.code === 'ETIMEDOUT') {