Skip to content

Commit

Permalink
test(discriminator): repro #5098
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Mar 23, 2017
1 parent 1d3a962 commit 432360e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/model.discriminator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,22 @@ describe('model', function() {
});
});

it('clone() allows reusing schemas (gh-5098)', function(done) {
var personSchema = new Schema({
name: String
}, { discriminatorKey: 'kind' });

var parentSchema = new Schema({
child: String
});

var Person = db.model('gh5098', personSchema);
var Parent = Person.discriminator('gh5098_0', parentSchema.clone());
// Should not throw
var Parent2 = Person.discriminator('gh5098_1', parentSchema.clone());
done();
});

it('embedded discriminators with $push (gh-5009)', function(done) {
var eventSchema = new Schema({ message: String },
{ discriminatorKey: 'kind', _id: false });
Expand Down

0 comments on commit 432360e

Please sign in to comment.