Wait for async saving and removing

This commit is contained in:
Veikko Karsikko
2015-02-18 22:06:00 +02:00
parent 6e1085e6f8
commit 1897ef985b
3 changed files with 12 additions and 12 deletions

View File

@@ -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);
});
});
});

View File

@@ -270,8 +270,8 @@ describe('Article CRUD tests', function() {
});
afterEach(function(done) {
User.remove().exec();
Article.remove().exec();
done();
User.remove().exec(function() {
Article.remove().exec(done);
});
});
});

View File

@@ -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();
});
});
});
@@ -69,7 +70,6 @@ describe('User Model Unit Tests:', function() {
});
after(function(done) {
User.remove().exec();
done();
User.remove().exec(done);
});
});