Skip to content

Commit

Permalink
test(document): add coverage for #11580
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Apr 29, 2022
1 parent 0ecae5c commit f7fe2c7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/document.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7445,13 +7445,22 @@ describe('document', function() {
const schema = new mongoose.Schema({ nested: { schema: String } });
const Model = db.model('Test', schema);


await Model.collection.insertOne({ nested: { schema: 'test' } });

const doc = await Model.findOne();
assert.strictEqual(doc.nested.schema, 'test');
});

it('handles nested properties named `on` (gh-11656)', async function() {
const schema = new mongoose.Schema({ on: String }, { supressReservedKeysWarning: true });
const Model = db.model('Test', schema);

await Model.create({ on: 'test string' });

const doc = await Model.findOne();
assert.strictEqual(doc.on, 'test string');
});

describe('overwrite() (gh-7830)', function() {
let Model;

Expand Down

0 comments on commit f7fe2c7

Please sign in to comment.