Skip to content

Commit

Permalink
test: extend test case for Automattic#11960 1
Browse files Browse the repository at this point in the history
  • Loading branch information
hasezoey committed Jun 28, 2022
1 parent d488b66 commit a0cd934
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions test/types/document.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,17 @@ async function gh11960() {

const ParentModel = model<DocumentType<Parent>>('Parent', ParentSchema);

const doc = new ParentModel({
username: 'user1',
map: { key1: 'value1', key2: 'value2' },
nested: { dummy: 'hello' },
nestedArray: [{ dummy: 'hello again' }]
});

expectType<Map<string, string> | undefined>(doc.map);
doc.nested!.parent();

{
const doc = new ParentModel({
username: 'user1',
map: { key1: 'value1', key2: 'value2' },
nested: { dummy: 'hello' },
nestedArray: [{ dummy: 'hello again' }]
});

expectType<Document<any, any, any> & Parent & { _id: Types.ObjectId }>(doc);
expectType<Map<string, string> | undefined>(doc.map);
doc.nested!.parent();
doc.nestedArray?.[0].parentArray();
}
}

0 comments on commit a0cd934

Please sign in to comment.