Skip to content

Commit

Permalink
Wait for async saving and removing
Browse files Browse the repository at this point in the history
  • Loading branch information
vepasto committed Feb 23, 2015
1 parent c68c393 commit 70828bf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions app/tests/article.server.model.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ describe('Article Model Unit Tests:', function() {
});

afterEach(function(done) {
Article.remove().exec();
User.remove().exec();
done();
Article.remove().exec(function() {
User.remove().exec(done);
});
});
});
});
8 changes: 4 additions & 4 deletions app/tests/article.server.routes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ describe('Article CRUD tests', function() {
});

afterEach(function(done) {
User.remove().exec();
Article.remove().exec();
done();
User.remove().exec(function() {
Article.remove().exec(done);
});
});
});
});
14 changes: 7 additions & 7 deletions app/tests/user.server.model.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ describe('User Model Unit Tests:', function() {
});

it('should fail to save an existing user again', function(done) {
user.save();
return user2.save(function(err) {
should.exist(err);
done();
user.save(function() {
user2.save(function(err) {
should.exist(err);
done();
});
});
});

Expand All @@ -69,7 +70,6 @@ describe('User Model Unit Tests:', function() {
});

after(function(done) {
User.remove().exec();
done();
User.remove().exec(done);
});
});
});

0 comments on commit 70828bf

Please sign in to comment.