📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP

mongoose-fixture-loader

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose-fixture-loader - npm Package Compare versions

Comparing version

to
1.0.1

{
"name": "mongoose-fixture-loader",
"version": "1.0.0",
"version": "1.0.1",
"description": "A simple fixture loader for Mongoose",

@@ -19,3 +19,3 @@ "main": "src/index.js",

],
"author": "Supasate Choochaisri",
"author": "Supasate Choochaisri (supasate.c@gmail.com)",
"license": "MIT",

@@ -22,0 +22,0 @@ "bugs": {

@@ -86,5 +86,7 @@ # Mongoose Fixture Loader

3. In your test file `test/index-test.js`, load the fixture into MongoDB.
3. In your test file `test/index-test.js`, you can load and test your fixture.
``` javascript
const expect = require('chai').expect;
const mongoose = require('mongoose');
const loadFixture = require('mongoose-fixture-loader');

@@ -94,3 +96,8 @@ const UserModel = require('../src/models/user-model.js');

// Mongoose default promise is deprecated
mongoose.Promise = global.Promise;
describe('a test suite', () => {
mongoose.connect('mongodb://localhost/mongoose-fixture-loader-test');
before((done) => {

@@ -105,3 +112,28 @@ loadFixture(UserModel, user)

});
after((done) => {
UserModel.remove({})
.then(() => {
return mongoose.connection.close();
})
.then(() => {
done();
})
.catch((err) => {
done(err);
});
});
it('should find John', (done) => {
UserModel.find({})
.then((users) => {
expect(users[0].firstName).to.equal('John');
done();
})
.catch((err) => {
done(err);
});
});
});
```

@@ -124,2 +156,2 @@

Licensed under the [Apache License](https://github.com/supasate/Interest-Rate-Parity-JS/blob/master/LICENSE).
Licensed under the [Apache License](https://github.com/supasate/mongoose-fixture-loader/blob/master/LICENSE).