Skip to content

Commit

Permalink
test: fix tests re: #8940
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed May 15, 2020
1 parent dcacea6 commit d5fa450
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions test/schema.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1436,12 +1436,6 @@ describe('schema', function() {
});
}, /`schema` may not be used as a schema pathname/);

assert.throws(function() {
new Schema({
db: String
});
}, /`db` may not be used as a schema pathname/);

assert.throws(function() {
new Schema({
isNew: String
Expand Down Expand Up @@ -2413,21 +2407,21 @@ describe('schema', function() {

describe('Schema.reserved (gh-8869)', function() {
it('throws errors on compiling schema with reserved key as a flat type', function() {
const buildInvalidSchema = () => new Schema({ db: String });
const buildInvalidSchema = () => new Schema({ save: String });

assert.throws(buildInvalidSchema, /`db` may not be used as a schema pathname/);
assert.throws(buildInvalidSchema, /`save` may not be used as a schema pathname/);
});

it('throws errors on compiling schema with reserved key as a nested object', function() {
const buildInvalidSchema = () => new Schema({ db: { nested: String } });
const buildInvalidSchema = () => new Schema({ save: { nested: String } });

assert.throws(buildInvalidSchema, /`db` may not be used as a schema pathname/);
assert.throws(buildInvalidSchema, /`save` may not be used as a schema pathname/);
});

it('throws errors on compiling schema with reserved key as a nested array', function() {
const buildInvalidSchema = () => new Schema({ db: [{ nested: String }] });
const buildInvalidSchema = () => new Schema({ save: [{ nested: String }] });

assert.throws(buildInvalidSchema, /`db` may not be used as a schema pathname/);
assert.throws(buildInvalidSchema, /`save` may not be used as a schema pathname/);
});
});
});

0 comments on commit d5fa450

Please sign in to comment.