Skip to content

Commit 2bcf4fa

Browse files
authored
make tests pass
1 parent d5cf4ca commit 2bcf4fa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/model.findByIdAndUpdate.test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ describe('model: findByIdAndUpdate:', function() {
6969

7070
schema.path('shape').discriminator('gh8378_Circle',
7171
Schema({ radius: String, color: String }));
72-
// schema.path('shape').discriminator('gh8378_Square',
73-
// Schema({ side: Number, color: String }));
72+
schema.path('shape').discriminator('gh8378_Square',
73+
Schema({ side: Number, color: String }));
7474

7575
const MyModel = db.model('Test', schema);
7676

@@ -89,11 +89,11 @@ describe('model: findByIdAndUpdate:', function() {
8989
'shape.name': 'after',
9090
'shape.side': 4,
9191
'shape.color': 'white'
92-
}, { new: true });
92+
}, { new: true, overwriteDiscriminatorKey: true });
9393

9494
assert.equal(doc.shape.kind, 'gh8378_Square');
9595
assert.equal(doc.shape.name, 'after');
96-
assert.equal(doc.shape.side, 4); // this assertion is failing, this property is not updated
96+
assert.equal(doc.shape.side, 4);
9797
assert.equal(doc.shape.color, 'white');
9898
});
9999
});

0 commit comments

Comments
 (0)