Skip to content

Commit

Permalink
updated test to use async to create records properly
Browse files Browse the repository at this point in the history
  • Loading branch information
nullivex committed Dec 17, 2013
1 parent 7300710 commit fa75dda
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
15 changes: 12 additions & 3 deletions test/mongoose-list.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('MongooseList',function(){
var Model = require('./model').model
, async = require('async')
describe('[Single Record]',function(){
var doc
before(function(done){
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit fa75dda

Please sign in to comment.