Skip to content

Commit

Permalink
test(schema): repro #8627
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Mar 7, 2020
1 parent 059825b commit 63fe55d
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions test/types.embeddeddocumentdeclarative.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@ const Schema = mongoose.Schema;

describe('types.embeddeddocumentdeclarative', function() {
describe('with a parent with a field with type set to a POJO', function() {
const ChildSchemaDef = {
name: String,
};

const ParentSchemaDef = {
name: String,
child: {
type: ChildSchemaDef,
type: {
name: String
}
}
};

Expand Down Expand Up @@ -71,6 +69,19 @@ describe('types.embeddeddocumentdeclarative', function() {
assert.strictEqual(princessZelda.mixedUp, undefined);
done();
});

it('underneath array (gh-8627)', function() {
const schema = new Schema({
arr: [{
nested: {
type: { test: String }
}
}]
}, { typePojoToMixed: false });

assert.ok(schema.path('arr').schema.path('nested').instance !== 'Mixed');
assert.ok(schema.path('arr').schema.path('nested.test') instanceof mongoose.Schema.Types.String);
});
});
});
describe('with a parent with a POJO field with a field "type" with a type set to "String"', function() {
Expand Down

0 comments on commit 63fe55d

Please sign in to comment.