From ac3bc522a3e2fdaa0b75888d9d38060a0de6c357 Mon Sep 17 00:00:00 2001 From: bailey Date: Wed, 15 Jan 2025 12:54:30 -0700 Subject: [PATCH] comments --- lib/encryption_utils.js | 4 ++-- test/encrypted_schema.test.js | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/encryption_utils.js b/lib/encryption_utils.js index 1f17fa5032..916ef17a5c 100644 --- a/lib/encryption_utils.js +++ b/lib/encryption_utils.js @@ -1,6 +1,6 @@ 'use strict'; -const { Array } = require('./schema/index.js'); +const schemaTypes = require('./schema/index.js'); const SchemaBigInt = require('./schema/bigint'); const SchemaBoolean = require('./schema/boolean'); const SchemaBuffer = require('./schema/buffer'); @@ -60,7 +60,7 @@ function inferBSONType(schema, path) { return 'double'; } - if (type instanceof Array) { + if (type instanceof schemaTypes.Array) { return 'array'; } diff --git a/test/encrypted_schema.test.js b/test/encrypted_schema.test.js index b59c753304..e99940c44f 100644 --- a/test/encrypted_schema.test.js +++ b/test/encrypted_schema.test.js @@ -144,8 +144,13 @@ describe('encrypted schema declaration', function() { } } - // Don't forget to add `Int8` to the type registry - mongoose.Schema.Types.Int8 = Int8; + this.beforeEach(function() { + // Don't forget to add `Int8` to the type registry + mongoose.Schema.Types.Int8 = Int8; + }); + this.afterEach(function() { + delete mongoose.Schema.Types.Int8; + }); it('Then an error is thrown', function() { assert.throws(() => {