diff --git a/package.json b/package.json index 9afbfb4..ea3197a 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "mocha": "~1.15.1", "chai": "~1.8.1", "jshint-stylish": "~0.1.3", - "mongoose": "~3.8.2" + "mongoose": "~3.8.2", + "async": "~0.2.9" }, "scripts": { "test": "grunt test" diff --git a/test/mongoose-list.test.js b/test/mongoose-list.test.js index f190091..bddba70 100644 --- a/test/mongoose-list.test.js +++ b/test/mongoose-list.test.js @@ -1,5 +1,6 @@ describe('MongooseList',function(){ var Model = require('./model').model + , async = require('async') describe('[Single Record]',function(){ var doc before(function(done){ @@ -46,11 +47,19 @@ describe('MongooseList',function(){ }) }) describe('[Multiple Records]',function(){ - before(function(){ + before(function(done){ + var items = [] for(var i=0; i<100; i++){ - var doc = new Model({name: 'test doc'}) - doc.save() + items.push({name: 'test doc'}) } + async.each( + items, + function(item,next){ + var doc = new Model(item) + doc.save(next) + }, + done + ) }) after(function(done){ Model.remove({name: 'test doc'},done)