updating the schema save pre hook so that it checks for a modified version of the password field before it tries to re-calculate the new password to save for the user model

This commit is contained in:
Liran Tal
2015-07-11 12:24:32 +03:00
parent 9e8ee9ea13
commit bf79c17bd0
2 changed files with 11 additions and 1 deletions

View File

@@ -67,6 +67,16 @@ describe('User Model Unit Tests:', function() {
done();
});
});
it('should confirm that saving user model doesnt change the password', function(done) {
user.firstName = 'test';
var passwordBefore = user.password;
return user.save(function(err) {
var passwordAfter = user.password
passwordBefore.should.equal(passwordAfter);
done();
});
});
});
after(function(done) {