Skip to content

Commit

Permalink
test(map): add coverage for update validators
Browse files Browse the repository at this point in the history
Re: #681
  • Loading branch information
vkarpov15 committed Apr 13, 2018
1 parent 51671fb commit 52cc6a9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/types.map.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,21 @@ describe('Map', function() {
assert.ok(err.errors['ratings.github']);
}
assert.ok(threw);

doc.ratings.set('github', 8);
// Shouldn't throw
yield doc.save();

threw = false;
try {
yield Test.updateOne({}, { $set: { 'ratings.github': 11 } }, {
runValidators: true
});
} catch (err) {
threw = true;
assert.ok(err.errors['ratings.github']);
}
assert.ok(threw);
});
});

Expand Down

0 comments on commit 52cc6a9

Please sign in to comment.