From 081f2ec95e1c1868f05d80b6f200c7c4e43529cb Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Tue, 5 Nov 2019 19:42:24 -0500 Subject: [PATCH] test(schema): repro #8292 --- test/schema.test.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/schema.test.js b/test/schema.test.js index 23ecf032ba4..62a813408bf 100644 --- a/test/schema.test.js +++ b/test/schema.test.js @@ -2144,4 +2144,14 @@ describe('schema', function() { filter(key => ['constructor', 'cast', 'castForQuery', 'checkRequired'].indexOf(key) === -1); assert.deepEqual(keys.sort(), functions.sort()); }); + + it('supports passing schema options to `Schema#path()` (gh-8292)', function() { + const schema = Schema({ title: String }); + const path = schema.path('title'); + + const newSchema = Schema({}); + newSchema.add({ title: path.options }); + + assert.equal(newSchema.path('title').options.type, String); + }); });