Skip to content

Commit

Permalink
test(model): add test for issue Automattic#8040 re: Automattic#8048 A…
Browse files Browse the repository at this point in the history
  • Loading branch information
Fonger committed Nov 14, 2019
1 parent 98facde commit 0c0833a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/model.test.js
Original file line number Diff line number Diff line change
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 0c0833a

Please sign in to comment.