Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Merge pull request #771 from lirantal/bugfix/fix_user_module_async_tests
Browse files Browse the repository at this point in the history
Fixing user model test's last test which fail or report a false positive
  • Loading branch information
lirantal committed Aug 13, 2015
2 parents 0be1b11 + 463f5b9 commit 609d958
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions modules/users/tests/server/user.server.model.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,24 @@ describe('User Model Unit Tests:', function () {
});
});

it('should not be able to save different user with the same email address', function () {
it('should not be able to save another user with the same email address', function (done) {
// Test may take some time to complete due to db operations
this.timeout(10000);

var _user = new User(user);
var _user3 = new User(user3);

_user.remove(function (err) {
should.not.exist(err);
_user.save(function (err) {
var user3_email = _user3.email;
should.not.exist(err);
_user3.email = _user.email;
_user3.save(function (err) {
should.exist(err);
// Restoring the original email for test3 so it can be used in later tests
_user3.email = user3_email;
_user.remove(function(err) {
should.not.exist(err);
done();
});
});
});
});
Expand Down

0 comments on commit 609d958

Please sign in to comment.