Created
December 17, 2012 20:15
-
-
Save davisford/4321730 to your computer and use it in GitHub Desktop.
mocha.js + mongoosejs database test skeleton
This file contains hidden or 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
| var mongoose = require('mongoose'); | |
| mongoose.connection.on('error', function (err) { | |
| console.log('mongoose err: ', err); | |
| }); | |
| mongoose.connection.on('open', function () { | |
| console.log('mongoose connection established'); | |
| }); | |
| describe('Foo', function () { | |
| before(function (done) { | |
| mongoose.connect('mongodb://localhost/test'); | |
| done(); | |
| }); | |
| after(function (done) { | |
| mongoose.disconnect(function () { | |
| console.log('disconnected'); | |
| done(); | |
| }); | |
| }); | |
| it('should test something', function (done) { | |
| 'one'.should.equal('one'); | |
| done(); | |
| }); | |
| it('should test something else ', function (done) { | |
| 'two'.should.equal('two'); | |
| done(); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment