mongoose-erase
Version:
Erase collections, models and schemas for unit testing with mongoose
22 lines (14 loc) • 956 B
Markdown
# mongoose-erase
[](https://travis-ci.org/paperhive/mongoose-erase) [](https://coveralls.io/r/paperhive/mongoose-erase?branch=master) [](https://gemnasium.com/paperhive/mongoose-erase)
[](https://nodei.co/npm/mongoose-erase/)
Erase collections, models and schemas for unit testing with mongoose
# Usage
With `mocha`, a unit test code that wipes the database before each test could look like this:
```javascript
var mongoose = require('mongoose');
var erase = require('mongoose-erase');
describe('yourFunction()', function() {
beforeEach(erase.connectAndErase(mongoose, 'mongodb://localhost/test'));
it('should do something', function() {});
});
```