diff --git a/test/basic-querying.test.js b/test/basic-querying.test.js index e4a58f6b..5129c5af 100644 --- a/test/basic-querying.test.js +++ b/test/basic-querying.test.js @@ -33,6 +33,7 @@ describe('basic-querying', function() { it('should query by id: found', function(done) { User.create(function(err, u) { + should.not.exist(err); should.exist(u.id); User.find(u.id, function(err, u) { should.exist(u); diff --git a/test/hooks.test.js b/test/hooks.test.js index 235b1fcd..47031856 100644 --- a/test/hooks.test.js +++ b/test/hooks.test.js @@ -132,6 +132,31 @@ describe('hooks', function() { }); }); }); + + it('should save actual modifications on updateAttributes', function(done) { + User.beforeSave = function(next, data) { + data.password = 'hash'; + next(); + }; + User.destroyAll(function() { + User.create({ + email: 'james.bond@example.com' + }, function(err, u) { + u.updateAttribute('password', 'new password', function(e, u) { + should.not.exist(e); + should.exist(u); + u.password.should.equal('hash'); + User.findOne({ + where: {email: 'james.bond@example.com'} + }, function(err, jb) { + jb.password.should.equal('hash'); + done(); + }); + }); + }); + }); + }); + }); describe('update', function() {