Skip to content

Commit

Permalink
test(document): repro #9392
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Sep 9, 2020
1 parent 287cc87 commit 61885f2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/document.test.js
Expand Up @@ -9311,4 +9311,18 @@ describe('document', function() {
assert.equal(fromDb.children.length, 0);
});
});

it('allows setting nested path to instance of model (gh-9392)', function() {
const def = { test: String };
const Child = db.model('Child', def);

const Parent = db.model('Parent', { nested: def });

const c = new Child({ test: 'new' });

const p = new Parent({ nested: { test: 'old' } });
p.nested = c;

assert.equal(p.nested.test, 'new');
});
});

0 comments on commit 61885f2

Please sign in to comment.