Created
February 17, 2020 04:02
-
-
Save crazyones110/e7914cff02c78da82d13f90c371259e6 to your computer and use it in GitHub Desktop.
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
const mongoose = require('mongoose') | |
// ES6 | |
mongoose.Promise = global.Promise | |
// Connect to the db before tests run | |
before(done => { | |
// Connect to mongodb | |
mongoose.connect('mongodb://localhost/testaroo', { | |
useNewUrlParser: true, | |
useUnifiedTopology: true | |
}) | |
mongoose.connection | |
.once('open', () => { | |
console.log('Connection has been made, now make fireworks') | |
done() | |
}) | |
.on('error', error => { | |
console.log('Connection error:', error) | |
}) | |
}) | |
// Drop the characters collections before each test | |
beforeEach(done => { | |
// Drop the collection | |
mongoose.connection.collections.mariochars.drop(() => { | |
done() | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment