-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc9e55d
commit 6f3b6f7
Showing
2 changed files
with
17 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
import mongoose from 'mongoose'; | ||
import config from '../../src/config'; | ||
// import mongoose from 'mongoose'; | ||
// import config from '../../src/config'; | ||
|
||
const setupTestDB = () => { | ||
beforeAll(async () => { | ||
mongoose.set('strictQuery', false); | ||
await mongoose.connect(config.mongoose.serverURL); | ||
}); | ||
// const setupTestDB = () => { | ||
// beforeAll(async () => { | ||
// mongoose.set('strictQuery', false); | ||
// await mongoose.connect(config.mongoose.serverURL); | ||
// }); | ||
|
||
beforeEach(async () => { | ||
await Promise.all( | ||
Object.values(mongoose.connection.collections).map(async (collection) => collection.deleteMany({})), | ||
); | ||
}); | ||
// beforeEach(async () => { | ||
// await Promise.all( | ||
// Object.values(mongoose.connection.collections).map(async (collection) => collection.deleteMany({})), | ||
// ); | ||
// }); | ||
|
||
afterAll(async () => { | ||
await mongoose.disconnect(); | ||
}); | ||
}; | ||
// afterAll(async () => { | ||
// await mongoose.disconnect(); | ||
// }); | ||
// }; | ||
|
||
export default setupTestDB; | ||
// export default setupTestDB; |