Skip to content

Commit

Permalink
Failing test for next(undefined)
Browse files Browse the repository at this point in the history
Results in the callback to save never being fired
  • Loading branch information
cleishm authored and aheckmann committed Apr 19, 2012
1 parent fd01d6b commit b3dbe99
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/model.test.js
Expand Up @@ -3135,11 +3135,18 @@ module.exports = {
});
},

'passing null in pre hook works': function () {
'passing undefined and null in pre hook works': function () {
var db = start();
var schema = new Schema({ name: String });
var called = 0;

schema.pre('save', function (next) {
called++;
next(undefined); // <<-----
});

schema.pre('save', function (next) {
called++;
next(null); // <<-----
});

Expand All @@ -3148,9 +3155,9 @@ module.exports = {

s.save(function (err) {
db.close();
called.should.equal(2);
should.strictEqual(null, err);
});

},

'pre hooks called on all sub levels': function () {
Expand Down

0 comments on commit b3dbe99

Please sign in to comment.