()
| 145 | } |
| 146 | |
| 147 | async function createWithDocArray() { |
| 148 | const schema = new Schema({ name: String, subdocs: [new Schema({ prop: { type: String, required: true } })] }); |
| 149 | const TestModel = model('Test', schema); |
| 150 | const doc = await TestModel.create({ name: 'test', subdocs: [{ prop: 'value' }] }); |
| 151 | expect(doc.name).type.toBe<string | null | undefined>(); |
| 152 | expect(doc.subdocs[0].prop).type.toBe<string>(); |
| 153 | } |
| 154 | |
| 155 | async function createWithMapOfSubdocs() { |
| 156 | const schema = new Schema({ |