From 32cf9630bc1293f79190a275c6397af5c5b8a856 Mon Sep 17 00:00:00 2001 From: bailey Date: Wed, 15 Jan 2025 13:29:36 -0700 Subject: [PATCH] fix lint --- lib/schema.js | 94 +++++++++---------- test/encrypted_schema.test.js | 166 +++++++++++++++++----------------- 2 files changed, 130 insertions(+), 130 deletions(-) diff --git a/lib/schema.js b/lib/schema.js index 3be43c6824..3c2eded584 100644 --- a/lib/schema.js +++ b/lib/schema.js @@ -212,16 +212,16 @@ function aliasFields(schema, paths) { schema. virtual(a). - get((function (p) { - return function () { + get((function(p) { + return function() { if (typeof this.get === 'function') { return this.get(p); } return this[p]; }; })(prop)). - set((function (p) { - return function (v) { + set((function(p) { + return function(v) { return this.$set(p, v); }; })(prop)); @@ -238,16 +238,16 @@ function aliasFields(schema, paths) { schema. virtual(alias). - get((function (p) { - return function () { + get((function(p) { + return function() { if (typeof this.get === 'function') { return this.get(p); } return this[p]; }; })(prop)). - set((function (p) { - return function (v) { + set((function(p) { + return function(v) { return this.$set(p, v); }; })(prop)); @@ -390,7 +390,7 @@ Schema.prototype.tree; * @instance */ -Schema.prototype.clone = function () { +Schema.prototype.clone = function() { const s = this._clone(); // Bubble up `init` for backwards compat @@ -410,7 +410,7 @@ Schema.prototype._clone = function _clone(Constructor) { s.base = this.base; s.obj = this.obj; s.options = clone(this.options); - s.callQueue = this.callQueue.map(function (f) { return f; }); + s.callQueue = this.callQueue.map(function(f) { return f; }); s.methods = clone(this.methods); s.methodOptions = clone(this.methodOptions); s.statics = clone(this.statics); @@ -493,7 +493,7 @@ Schema.prototype._clone = function _clone(Constructor) { * @api public */ -Schema.prototype.pick = function (paths, options) { +Schema.prototype.pick = function(paths, options) { const newSchema = new Schema({}, options || this.options); if (!Array.isArray(paths)) { throw new MongooseError('Schema#pick() only accepts an array argument, ' + @@ -549,7 +549,7 @@ Schema.prototype.pick = function (paths, options) { * @api public */ -Schema.prototype.omit = function (paths, options) { +Schema.prototype.omit = function(paths, options) { const newSchema = new Schema(this, options || this.options); if (!Array.isArray(paths)) { throw new MongooseError( @@ -579,7 +579,7 @@ Schema.prototype.omit = function (paths, options) { * @api private */ -Schema.prototype.defaultOptions = function (options) { +Schema.prototype.defaultOptions = function(options) { this._userProvidedOptions = options == null ? {} : clone(options); const baseOptions = this.base && this.base.options || {}; const strict = 'strict' in baseOptions ? baseOptions.strict : true; @@ -656,7 +656,7 @@ Schema.prototype.defaultOptions = function (options) { * @return {Schema} the Schema instance * @api public */ -Schema.prototype.discriminator = function (name, schema, options) { +Schema.prototype.discriminator = function(name, schema, options) { this._applyDiscriminators = this._applyDiscriminators || new Map(); this._applyDiscriminators.set(name, { schema, options }); @@ -668,7 +668,7 @@ Schema.prototype.discriminator = function (name, schema, options) { * options. */ -Schema.prototype._defaultToObjectOptions = function (json) { +Schema.prototype._defaultToObjectOptions = function(json) { const path = json ? 'toJSON' : 'toObject'; if (this._defaultToObjectOptionsMap && this._defaultToObjectOptionsMap[path]) { return this._defaultToObjectOptionsMap[path]; @@ -1133,7 +1133,7 @@ reserved.collection = 1; * @api public */ -Schema.prototype.path = function (path, obj) { +Schema.prototype.path = function(path, obj) { if (obj === undefined) { if (this.paths[path] != null) { return this.paths[path]; @@ -1434,7 +1434,7 @@ Object.defineProperty(Schema.prototype, 'base', { * @api private */ -Schema.prototype.interpretAsType = function (path, obj, options) { +Schema.prototype.interpretAsType = function(path, obj, options) { if (obj instanceof SchemaType) { if (obj.path === path) { return obj; @@ -1709,7 +1709,7 @@ function createMapNestedSchemaType(schema, schemaType, path, obj, options) { * @api public */ -Schema.prototype.eachPath = function (fn) { +Schema.prototype.eachPath = function(fn) { const keys = Object.keys(this.paths); const len = keys.length; @@ -1790,7 +1790,7 @@ Schema.prototype.indexedPaths = function indexedPaths() { * @api public */ -Schema.prototype.pathType = function (path) { +Schema.prototype.pathType = function(path) { if (this.paths.hasOwnProperty(path)) { return 'real'; } @@ -1833,7 +1833,7 @@ Schema.prototype.pathType = function (path) { * @api private */ -Schema.prototype.hasMixedParent = function (path) { +Schema.prototype.hasMixedParent = function(path) { const subpaths = path.split(/\./g); path = ''; for (let i = 0; i < subpaths.length; ++i) { @@ -1853,7 +1853,7 @@ Schema.prototype.hasMixedParent = function (path) { * @param {Boolean|Object} timestamps timestamps options * @api private */ -Schema.prototype.setupTimestamp = function (timestamps) { +Schema.prototype.setupTimestamp = function(timestamps) { return setupTimestamps(this, timestamps); }; @@ -1951,7 +1951,7 @@ function getPositionalPath(self, path, cleanPath) { * @api public */ -Schema.prototype.queue = function (name, args) { +Schema.prototype.queue = function(name, args) { this.callQueue.push([name, args]); return this; }; @@ -1999,7 +1999,7 @@ Schema.prototype.queue = function (name, args) { * @api public */ -Schema.prototype.pre = function (name) { +Schema.prototype.pre = function(name) { if (name instanceof RegExp) { const remainingArgs = Array.prototype.slice.call(arguments, 1); for (const fn of hookNames) { @@ -2057,7 +2057,7 @@ Schema.prototype.pre = function (name) { * @api public */ -Schema.prototype.post = function (name) { +Schema.prototype.post = function(name) { if (name instanceof RegExp) { const remainingArgs = Array.prototype.slice.call(arguments, 1); for (const fn of hookNames) { @@ -2100,7 +2100,7 @@ Schema.prototype.post = function (name) { * @api public */ -Schema.prototype.plugin = function (fn, opts) { +Schema.prototype.plugin = function(fn, opts) { if (typeof fn !== 'function') { throw new Error('First param to `schema.plugin()` must be a function, ' + 'got "' + (typeof fn) + '"'); @@ -2155,7 +2155,7 @@ Schema.prototype.plugin = function (fn, opts) { * @api public */ -Schema.prototype.method = function (name, fn, options) { +Schema.prototype.method = function(name, fn, options) { if (typeof name !== 'string') { for (const i in name) { this.methods[i] = name[i]; @@ -2201,7 +2201,7 @@ Schema.prototype.method = function (name, fn, options) { * @see Statics https://mongoosejs.com/docs/guide.html#statics */ -Schema.prototype.static = function (name, fn) { +Schema.prototype.static = function(name, fn) { if (typeof name !== 'string') { for (const i in name) { this.statics[i] = name[i]; @@ -2226,7 +2226,7 @@ Schema.prototype.static = function (name, fn) { * @api public */ -Schema.prototype.index = function (fields, options) { +Schema.prototype.index = function(fields, options) { fields || (fields = {}); options || (options = {}); @@ -2272,7 +2272,7 @@ Schema.prototype.index = function (fields, options) { * @api public */ -Schema.prototype.set = function (key, value, tags) { +Schema.prototype.set = function(key, value, tags) { if (arguments.length === 1) { return this.options[key]; } @@ -2363,7 +2363,7 @@ function _propagateOptionsToImplicitlyCreatedSchemas(baseSchema, options) { * @return {Any} the option's value */ -Schema.prototype.get = function (key) { +Schema.prototype.get = function(key) { return this.options[key]; }; @@ -2379,10 +2379,10 @@ const indexTypes = '2d 2dsphere hashed text'.split(' '); */ Object.defineProperty(Schema, 'indexTypes', { - get: function () { + get: function() { return indexTypes; }, - set: function () { + set: function() { throw new Error('Cannot overwrite Schema.indexTypes'); } }); @@ -2417,7 +2417,7 @@ Object.defineProperty(Schema, 'indexTypes', { * @return {Array} list of indexes defined in the schema */ -Schema.prototype.indexes = function () { +Schema.prototype.indexes = function() { return getIndexes(this); }; @@ -2437,7 +2437,7 @@ Schema.prototype.indexes = function () { * @return {VirtualType} */ -Schema.prototype.virtual = function (name, options) { +Schema.prototype.virtual = function(name, options) { if (name instanceof VirtualType || getConstructorName(name) === 'VirtualType') { return this.virtual(name.path, name.options); } @@ -2493,7 +2493,7 @@ Schema.prototype.virtual = function (name, options) { }); virtual. - set(function (v) { + set(function(v) { if (!this.$$populatedVirtuals) { this.$$populatedVirtuals = {}; } @@ -2539,7 +2539,7 @@ Schema.prototype.virtual = function (name, options) { ' conflicts with a real path in the schema'); } - virtuals[name] = parts.reduce(function (mem, part, i) { + virtuals[name] = parts.reduce(function(mem, part, i) { mem[part] || (mem[part] = (i === parts.length - 1) ? new VirtualType(options, name) : {}); @@ -2565,7 +2565,7 @@ Schema.prototype.virtual = function (name, options) { * @return {VirtualType|null} */ -Schema.prototype.virtualpath = function (name) { +Schema.prototype.virtualpath = function(name) { return this.virtuals.hasOwnProperty(name) ? this.virtuals[name] : null; }; @@ -2589,12 +2589,12 @@ Schema.prototype.virtualpath = function (name) { * @return {Schema} the Schema instance * @api public */ -Schema.prototype.remove = function (path) { +Schema.prototype.remove = function(path) { if (typeof path === 'string') { path = [path]; } if (Array.isArray(path)) { - path.forEach(function (name) { + path.forEach(function(name) { if (this.path(name) == null && !this.nested[name]) { return; } @@ -2648,7 +2648,7 @@ function _deletePath(schema, name) { * @api public */ -Schema.prototype.removeVirtual = function (path) { +Schema.prototype.removeVirtual = function(path) { if (typeof path === 'string') { path = [path]; } @@ -2710,7 +2710,7 @@ Schema.prototype.removeVirtual = function (path) { * @param {Function} model The Class to load * @param {Boolean} [virtualsOnly] if truthy, only pulls virtuals from the class, not methods or statics */ -Schema.prototype.loadClass = function (model, virtualsOnly) { +Schema.prototype.loadClass = function(model, virtualsOnly) { // Stop copying when hit certain base classes if (model === Object.prototype || model === Function.prototype || @@ -2723,7 +2723,7 @@ Schema.prototype.loadClass = function (model, virtualsOnly) { // Add static methods if (!virtualsOnly) { - Object.getOwnPropertyNames(model).forEach(function (name) { + Object.getOwnPropertyNames(model).forEach(function(name) { if (name.match(/^(length|name|prototype|constructor|__proto__)$/)) { return; } @@ -2735,7 +2735,7 @@ Schema.prototype.loadClass = function (model, virtualsOnly) { } // Add methods and virtuals - Object.getOwnPropertyNames(model.prototype).forEach(function (name) { + Object.getOwnPropertyNames(model.prototype).forEach(function(name) { if (name.match(/^(constructor)$/)) { return; } @@ -2766,7 +2766,7 @@ Schema.prototype.loadClass = function (model, virtualsOnly) { * ignore */ -Schema.prototype._getSchema = function (path) { +Schema.prototype._getSchema = function(path) { const _this = this; const pathschema = _this.path(path); const resultPath = []; @@ -2873,7 +2873,7 @@ Schema.prototype._getSchema = function (path) { * ignore */ -Schema.prototype._getPathType = function (path) { +Schema.prototype._getPathType = function(path) { const _this = this; const pathschema = _this.path(path); @@ -2883,8 +2883,8 @@ Schema.prototype._getPathType = function (path) { function search(parts, schema) { let p = parts.length + 1, - foundschema, - trypath; + foundschema, + trypath; while (p--) { trypath = parts.slice(0, p).join('.'); diff --git a/test/encrypted_schema.test.js b/test/encrypted_schema.test.js index 2867a3a3d7..a25480f4a6 100644 --- a/test/encrypted_schema.test.js +++ b/test/encrypted_schema.test.js @@ -25,8 +25,8 @@ function schemaHasEncryptedProperty(schema, path) { const KEY_ID = new UUID(); const algorithm = 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic'; -describe('encrypted schema declaration', function () { - describe('Tests that fields of valid schema types can be declared as encrypted schemas', function () { +describe('encrypted schema declaration', function() { + describe('Tests that fields of valid schema types can be declared as encrypted schemas', function() { const basicSchemaTypes = [ { type: String, name: 'string' }, { type: Schema.Types.Boolean, name: 'boolean' }, @@ -40,9 +40,9 @@ describe('encrypted schema declaration', function () { ]; for (const { type, name } of basicSchemaTypes) { - describe(`When a schema is instantiated with an encrypted field of type ${name}`, function () { + describe(`When a schema is instantiated with an encrypted field of type ${name}`, function() { let schema; - beforeEach(function () { + beforeEach(function() { schema = new Schema({ field: { type, encrypt: { keyId: KEY_ID, algorithm } @@ -52,15 +52,15 @@ describe('encrypted schema declaration', function () { }); }); - it(`Then the schema has an encrypted property of type ${name}`, function () { + it(`Then the schema has an encrypted property of type ${name}`, function() { assert.ok(schemaHasEncryptedProperty(schema, 'field')); }); }); } - describe('when a schema is instantiated with a nested encrypted schema', function () { + describe('when a schema is instantiated with a nested encrypted schema', function() { let schema; - beforeEach(function () { + beforeEach(function() { const encryptedSchema = new Schema({ encrypted: { type: String, encrypt: { keyId: KEY_ID, algorithm } @@ -72,14 +72,14 @@ describe('encrypted schema declaration', function () { }); - it('then the schema has a nested property that is encrypted', function () { + it('then the schema has a nested property that is encrypted', function() { assert.ok(schemaHasEncryptedProperty(schema, ['field', 'encrypted'])); }); }); - describe('when a schema is instantiated with a nested schema object', function () { + describe('when a schema is instantiated with a nested schema object', function() { let schema; - beforeEach(function () { + beforeEach(function() { schema = new Schema({ field: { encrypted: { @@ -89,14 +89,14 @@ describe('encrypted schema declaration', function () { }, { encryptionType: 'csfle' }); }); - it('then the schema has a nested property that is encrypted', function () { + it('then the schema has a nested property that is encrypted', function() { assert.ok(schemaHasEncryptedProperty(schema, ['field', 'encrypted'])); }); }); - describe('when a schema is instantiated as an Array', function () { + describe('when a schema is instantiated as an Array', function() { let schema; - beforeEach(function () { + beforeEach(function() { schema = new Schema({ encrypted: { type: [Number], @@ -105,16 +105,16 @@ describe('encrypted schema declaration', function () { }, { encryptionType: 'csfle' }); }); - it('then the schema has a nested property that is encrypted', function () { + it('then the schema has a nested property that is encrypted', function() { assert.ok(schemaHasEncryptedProperty(schema, 'encrypted')); }); }); }); - describe('invalid schema types for encrypted schemas', function () { - describe('When a schema is instantiated with an encrypted field of type Number', function () { - it('Then an error is thrown', function () { + describe('invalid schema types for encrypted schemas', function() { + describe('When a schema is instantiated with an encrypted field of type Number', function() { + it('Then an error is thrown', function() { assert.throws(() => { new Schema({ field: { @@ -125,8 +125,8 @@ describe('encrypted schema declaration', function () { }); }); - describe('When a schema is instantiated with an encrypted field of type Mixed', function () { - it('Then an error is thrown', function () { + describe('When a schema is instantiated with an encrypted field of type Mixed', function() { + it('Then an error is thrown', function() { assert.throws(() => { new Schema({ field: { @@ -137,22 +137,22 @@ describe('encrypted schema declaration', function () { }); }); - describe('When a schema is instantiated with a custom schema type plugin', function () { + describe('When a schema is instantiated with a custom schema type plugin', function() { class Int8 extends mongoose.SchemaType { constructor(key, options) { super(key, options, 'Int8'); } } - beforeEach(function () { + beforeEach(function() { // Don't forget to add `Int8` to the type registry mongoose.Schema.Types.Int8 = Int8; }); - afterEach(function () { + afterEach(function() { delete mongoose.Schema.Types.Int8; }); - it('Then an error is thrown', function () { + it('Then an error is thrown', function() { assert.throws(() => { new Schema({ field: { @@ -165,9 +165,9 @@ describe('encrypted schema declaration', function () { }); - describe('options.encryptionType', function () { - describe('when an encrypted schema is instantiated and an encryptionType is not provided', function () { - it('an error is thrown', function () { + describe('options.encryptionType', function() { + describe('when an encrypted schema is instantiated and an encryptionType is not provided', function() { + it('an error is thrown', function() { assert.throws( () => { new Schema({ @@ -183,8 +183,8 @@ describe('encrypted schema declaration', function () { }); }); - describe('when a nested encrypted schema is provided to schema constructor and the encryption types are different', function () { - it('then an error is thrown', function () { + describe('when a nested encrypted schema is provided to schema constructor and the encryption types are different', function() { + it('then an error is thrown', function() { const innerSchema = new Schema({ field1: { type: String, encrypt: { @@ -202,11 +202,11 @@ describe('encrypted schema declaration', function () { }); }); - describe('tests for schema mutation methods', function () { - describe('Schema.prototype.add()', function () { - describe('Given a schema with no encrypted fields', function () { - describe('When an encrypted field is added', function () { - it('Then the encrypted field is added to the encrypted fields for the schema', function () { + describe('tests for schema mutation methods', function() { + describe('Schema.prototype.add()', function() { + describe('Given a schema with no encrypted fields', function() { + describe('When an encrypted field is added', function() { + it('Then the encrypted field is added to the encrypted fields for the schema', function() { const schema = new Schema({ field1: Number }); @@ -219,10 +219,10 @@ describe('encrypted schema declaration', function () { }); }); - describe('Given a schema with an encrypted field', function () { - describe('when an encrypted field is added', function () { - describe('and the encryption type matches the existing encryption type', function () { - it('Then the encrypted field is added to the encrypted fields for the schema', function () { + describe('Given a schema with an encrypted field', function() { + describe('when an encrypted field is added', function() { + describe('and the encryption type matches the existing encryption type', function() { + it('Then the encrypted field is added to the encrypted fields for the schema', function() { const schema = new Schema({ field1: { type: String, encrypt: { keyId: KEY_ID, algorithm } } }, { encryptionType: 'csfle' }); @@ -235,9 +235,9 @@ describe('encrypted schema declaration', function () { }); }); - describe('Given a schema with an encrypted field', function () { - describe('when an encrypted field is added with different encryption settings for the same field', function () { - it('The encryption settings for the field are overridden', function () { + describe('Given a schema with an encrypted field', function() { + describe('when an encrypted field is added with different encryption settings for the same field', function() { + it('The encryption settings for the field are overridden', function() { const schema = new Schema({ field1: { type: String, encrypt: { keyId: KEY_ID, algorithm } } }, { encryptionType: 'csfle' }); @@ -249,8 +249,8 @@ describe('encrypted schema declaration', function () { }); - describe('When an unencrypted field is added for the same field', function () { - it('The field on the schema is overridden', function () { + describe('When an unencrypted field is added for the same field', function() { + it('The field on the schema is overridden', function() { const schema = new Schema({ field1: { type: String, encrypt: { keyId: KEY_ID, algorithm } } }, { encryptionType: 'csfle' }); @@ -263,9 +263,9 @@ describe('encrypted schema declaration', function () { }); }); - describe('Given a schema', function () { - describe('When multiple encrypted fields are added to the schema in one call to add()', function () { - it('Then all the encrypted fields are added to the schema', function () { + describe('Given a schema', function() { + describe('When multiple encrypted fields are added to the schema in one call to add()', function() { + it('Then all the encrypted fields are added to the schema', function() { const schema = new Schema({ field1: { type: String, encrypt: { keyId: KEY_ID, algorithm } } }, { encryptionType: 'csfle' }); @@ -283,10 +283,10 @@ describe('encrypted schema declaration', function () { }); }); - describe('Schema.prototype.remove()', function () { - describe('Given a schema with one encrypted field', function () { - describe('When the encrypted field is removed', function () { - it('Then the encrypted fields on the schema does not contain the removed field', function () { + describe('Schema.prototype.remove()', function() { + describe('Given a schema with one encrypted field', function() { + describe('When the encrypted field is removed', function() { + it('Then the encrypted fields on the schema does not contain the removed field', function() { const schema = new Schema({ field1: { type: String, encrypt: { keyId: KEY_ID, algorithm } } }, { encryptionType: 'csfle' }); @@ -297,9 +297,9 @@ describe('encrypted schema declaration', function () { }); }); - describe('Given a schema with multiple encrypted fields', function () { - describe('When one encrypted field is removed', function () { - it('The encrypted fields on the schema does not contain the removed field', function () { + describe('Given a schema with multiple encrypted fields', function() { + describe('When one encrypted field is removed', function() { + it('The encrypted fields on the schema does not contain the removed field', function() { const schema = new Schema({ field1: { type: String, encrypt: { keyId: KEY_ID, algorithm } }, name: { type: String, encrypt: { keyId: KEY_ID, algorithm } }, @@ -313,8 +313,8 @@ describe('encrypted schema declaration', function () { }); }); - describe('When all encrypted fields are removed', function () { - it('The encrypted fields on the schema does not contain the removed field', function () { + describe('When all encrypted fields are removed', function() { + it('The encrypted fields on the schema does not contain the removed field', function() { const schema = new Schema({ field1: { type: String, encrypt: { keyId: KEY_ID, algorithm } }, name: { type: String, encrypt: { keyId: KEY_ID, algorithm } }, @@ -329,8 +329,8 @@ describe('encrypted schema declaration', function () { }); }); - describe('when a nested encrypted property is removed', function () { - it('the encrypted field is removed from the schema', function () { + describe('when a nested encrypted property is removed', function() { + it('the encrypted field is removed from the schema', function() { const schema = new Schema({ field1: { name: { type: String, encrypt: { keyId: KEY_ID, algorithm } } } }, { encryptionType: 'csfle' }); @@ -345,24 +345,24 @@ describe('encrypted schema declaration', function () { }); }); - describe('tests for schema copying methods', function () { - describe('Schema.prototype.clone()', function () { - describe('Given a schema with encrypted fields', function () { - describe('When the schema is cloned', function () { - it('The resultant schema contains all the same encrypted fields as the original schema', function () { + describe('tests for schema copying methods', function() { + describe('Schema.prototype.clone()', function() { + describe('Given a schema with encrypted fields', function() { + describe('When the schema is cloned', function() { + it('The resultant schema contains all the same encrypted fields as the original schema', function() { const schema1 = new Schema({ name: { type: String, encrypt: { keyId: KEY_ID, algorithm } } }, { encryptionType: 'csfle' }); const schema2 = schema1.clone(); assert.equal(schemaHasEncryptedProperty(schema2, ['name']), true); }); - it('The encryption type of the cloned schema is the same as the original', function () { + it('The encryption type of the cloned schema is the same as the original', function() { const schema1 = new Schema({ name: { type: String, encrypt: { keyId: KEY_ID, algorithm } } }, { encryptionType: 'csfle' }); const schema2 = schema1.clone(); assert.equal(schema2._encryptionType, 'csfle'); }); - describe('When the cloned schema is modified', function () { - it('The original is not modified', function () { + describe('When the cloned schema is modified', function() { + it('The original is not modified', function() { const schema1 = new Schema({ name: { type: String, encrypt: { keyId: KEY_ID, algorithm } } }, { encryptionType: 'csfle' }); const schema2 = schema1.clone(); schema2.remove('name'); @@ -374,9 +374,9 @@ describe('encrypted schema declaration', function () { }); }); - describe('Schema.prototype.pick()', function () { - describe('When pick() is used with only unencrypted fields', function () { - it('Then the resultant schema has none of the original schema’s encrypted fields', function () { + describe('Schema.prototype.pick()', function() { + describe('When pick() is used with only unencrypted fields', function() { + it('Then the resultant schema has none of the original schema’s encrypted fields', function() { const originalSchema = new Schema({ name: { type: String, encrypt: { keyId: KEY_ID, algorithm } }, age: { type: Int32, encrypt: { keyId: KEY_ID, algorithm } }, @@ -389,7 +389,7 @@ describe('encrypted schema declaration', function () { assert.equal(schemaHasEncryptedProperty(schema2, ['name']), false); assert.equal(schemaHasEncryptedProperty(schema2, ['age']), false); }); - it('Then the encryption type is set to the cloned schemas encryptionType', function () { + it('Then the encryption type is set to the cloned schemas encryptionType', function() { const originalSchema = new Schema({ name: { type: String, encrypt: { keyId: KEY_ID, algorithm } }, age: { type: Int32, encrypt: { keyId: KEY_ID, algorithm } }, @@ -403,8 +403,8 @@ describe('encrypted schema declaration', function () { }); }); - describe('When pick() is used with some unencrypted fields', function () { - it('Then the resultant schema has the encrypted fields of the original schema that were specified to pick().', function () { + describe('When pick() is used with some unencrypted fields', function() { + it('Then the resultant schema has the encrypted fields of the original schema that were specified to pick().', function() { const originalSchema = new Schema({ name: { type: String, encrypt: { keyId: KEY_ID, algorithm } }, age: { type: Int32, encrypt: { keyId: KEY_ID, algorithm } }, @@ -417,7 +417,7 @@ describe('encrypted schema declaration', function () { assert.equal(schemaHasEncryptedProperty(schema2, ['name']), true); assert.equal(schemaHasEncryptedProperty(schema2, ['age']), false); }); - it('Then the encryption type is the same as the original schema’s encryption type', function () { + it('Then the encryption type is the same as the original schema’s encryption type', function() { const originalSchema = new Schema({ name: { type: String, encrypt: { keyId: KEY_ID, algorithm } }, age: { type: Int32, encrypt: { keyId: KEY_ID, algorithm } }, @@ -431,8 +431,8 @@ describe('encrypted schema declaration', function () { }); }); - describe('When pick() is used with nested paths', function () { - it('Then the resultant schema has the encrypted fields of the original schema that were specified to pick().', function () { + describe('When pick() is used with nested paths', function() { + it('Then the resultant schema has the encrypted fields of the original schema that were specified to pick().', function() { const originalSchema = new Schema({ name: { name: { type: String, encrypt: { keyId: KEY_ID, algorithm } } @@ -447,7 +447,7 @@ describe('encrypted schema declaration', function () { assert.equal(schemaHasEncryptedProperty(schema2, ['name', 'name']), true); assert.equal(schemaHasEncryptedProperty(schema2, ['age']), false); }); - it('Then the encryption type is the same as the original schema’s encryption type', function () { + it('Then the encryption type is the same as the original schema’s encryption type', function() { const originalSchema = new Schema({ name: { type: String, encrypt: { keyId: KEY_ID, algorithm } }, age: { type: Int32, encrypt: { keyId: KEY_ID, algorithm } }, @@ -462,9 +462,9 @@ describe('encrypted schema declaration', function () { }); }); - describe('Schema.prototype.omit()', function () { - describe('When omit() is used with only unencrypted fields', function () { - it('Then the resultant schema has all the original schema’s encrypted fields', function () { + describe('Schema.prototype.omit()', function() { + describe('When omit() is used with only unencrypted fields', function() { + it('Then the resultant schema has all the original schema’s encrypted fields', function() { const originalSchema = new Schema({ name: { type: String, encrypt: { keyId: KEY_ID, algorithm } }, age: { type: Int32, encrypt: { keyId: KEY_ID, algorithm } }, @@ -477,7 +477,7 @@ describe('encrypted schema declaration', function () { assert.equal(schemaHasEncryptedProperty(schema2, ['name']), true); assert.equal(schemaHasEncryptedProperty(schema2, ['age']), true); }); - it('Then the encryption type is the same as the original schema’s encryption type', function () { + it('Then the encryption type is the same as the original schema’s encryption type', function() { const originalSchema = new Schema({ name: { type: String, encrypt: { keyId: KEY_ID, algorithm } }, age: { type: Int32, encrypt: { keyId: KEY_ID, algorithm } }, @@ -491,8 +491,8 @@ describe('encrypted schema declaration', function () { }); }); - describe('When omit() is used with some unencrypted fields', function () { - it('Then the resultant schema has the encrypted fields of the original schema that were specified to omit()', function () { + describe('When omit() is used with some unencrypted fields', function() { + it('Then the resultant schema has the encrypted fields of the original schema that were specified to omit()', function() { const originalSchema = new Schema({ name: { type: String, encrypt: { keyId: KEY_ID, algorithm } }, age: { type: Int32, encrypt: { keyId: KEY_ID, algorithm } }, @@ -505,7 +505,7 @@ describe('encrypted schema declaration', function () { assert.equal(schemaHasEncryptedProperty(schema2, ['name']), false); assert.equal(schemaHasEncryptedProperty(schema2, ['age']), true); }); - it('Then the encryption type is the same as the original schema’s encryption type', function () { + it('Then the encryption type is the same as the original schema’s encryption type', function() { const originalSchema = new Schema({ name: { type: String, encrypt: { keyId: KEY_ID, algorithm } }, age: { type: Int32, encrypt: { keyId: KEY_ID, algorithm } }, @@ -519,8 +519,8 @@ describe('encrypted schema declaration', function () { }); }); - describe('When omit() is used with some all the encrypted fields', function () { - it('Then the encryption type is the same as the original schema’s encryption type', function () { + describe('When omit() is used with some all the encrypted fields', function() { + it('Then the encryption type is the same as the original schema’s encryption type', function() { const originalSchema = new Schema({ name: { type: String, encrypt: { keyId: KEY_ID, algorithm } }, age: { type: Int32, encrypt: { keyId: KEY_ID, algorithm } },