diff --git a/test/hooks.test.js b/test/hooks.test.js index 5ded42ee..02a04738 100644 --- a/test/hooks.test.js +++ b/test/hooks.test.js @@ -110,6 +110,26 @@ describe('hooks', function() { user.save(); }); }); + + it('should save actual modifications to database', function(done) { + User.beforeSave = function(next, data) { + data.password = 'hash'; + next(); + }; + User.destroyAll(function() { + User.create({ + email: 'james.bond@example.com', + password: 'secret' + }, function() { + User.findOne({ + where: {email: 'james.bond@example.com'} + }, function(err, jb) { + jb.password.should.equal('hash'); + done(); + }); + }); + }); + }); }); describe('update', function() {