Skip to content

Commit

Permalink
test(map): repro #8357
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Dec 1, 2019
1 parent 58c8e41 commit 6248073
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/types.map.test.js
Expand Up @@ -743,4 +743,20 @@ describe('Map', function() {
assert.ok(err.errors['myMap.foo.test'].message.indexOf('required') !== -1,
err.errors['myMap.foo.test'].message);
});

it('works with clone() (gh-8357)', function() {
const childSchema = mongoose.Schema({ name: String });
const schema = mongoose.Schema({
myMap: {
type: Map,
of: childSchema
}
});
const Model = db.model('gh8357', schema.clone());

const doc = new Model({ myMap: { foo: { name: 'bar' } } });

const err = doc.validateSync();
assert.ifError(err);
});
});

0 comments on commit 6248073

Please sign in to comment.