chore: mongodb destroy connections outside of tests

This commit is contained in:
Dan Ribbens
2023-09-25 11:39:22 -04:00
parent 4ba5d723f5
commit beb7647bc7

View File

@@ -4,10 +4,12 @@ import mongoose from 'mongoose'
import type { MongooseAdapter } from './index'
export const destroy: Destroy = async function destroy(this: MongooseAdapter) {
export const destroy: Destroy = async function destroy (this: MongooseAdapter) {
if (this.mongoMemoryServer) {
await mongoose.connection.dropDatabase()
await mongoose.connection.close()
await this.mongoMemoryServer.stop()
} else {
await mongoose.connection.close()
}
}