mongoose-erase

2.0.9 • Public • Published

mongoose-erase

Build Status Coverage Status Dependency Status

NPM

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:

var mongoose = require('mongoose');
var erase = require('mongoose-erase');
 
describe('yourFunction()', function() {
 
  beforeEach(erase.connectAndErase(mongoose, 'mongodb://localhost/test'));
 
  it('should do something', function() {});
 
});

Package Sidebar

Install

npm i mongoose-erase

Weekly Downloads

2

Version

2.0.9

License

GPL-3.0

Last publish

Collaborators

  • andrenarchy