Skip to content

Commit

Permalink
Merge pull request #8341 from Fonger/fix/memory-leak
Browse files Browse the repository at this point in the history
test(model): add test for issue #8040 re: #8048 #8326
  • Loading branch information
vkarpov15 committed Nov 14, 2019
2 parents e5c6ded + 0c0833a commit e268572
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/model.test.js
Expand Up @@ -3816,6 +3816,23 @@ describe('Model', function() {
});
});
});
it('should clear $versionError and saveOptions after saved (gh-8040)', function(done) {
const schema = new Schema({name: String});
const Model = db.model('gh8040', schema);
const doc = new Model({
name: 'Fonger'
});

const savePromise = doc.save();
assert.ok(doc.$__.$versionError);
assert.ok(doc.$__.saveOptions);

savePromise.then(function() {
assert.ok(!doc.$__.$versionError);
assert.ok(!doc.$__.saveOptions);
done();
}).catch(done);
});
});


Expand Down

0 comments on commit e268572

Please sign in to comment.