Skip to content

Commit

Permalink
test(schema): repro #8111
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Sep 1, 2019
1 parent 970faf4 commit 29b232e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/schema.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2101,4 +2101,16 @@ describe('schema', function() {
assert.ok(schema.path('arr.name') instanceof SchemaTypes.String);
assert.ok(schema.path('arr.0.name') instanceof SchemaTypes.String);
});

it('required paths with clone() (gh-8111)', function() {
const schema = Schema({ field: { type: String, required: true } });
const Model = db.model('gh8111', schema.clone());

const doc = new Model({});

return doc.validate().then(() => assert.ok(false), err => {
assert.ok(err);
assert.ok(err.errors['field']);
});
});
});

0 comments on commit 29b232e

Please sign in to comment.