Skip to content

Commit ac3bc52

Browse files
comments
1 parent 42d9607 commit ac3bc52

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

lib/encryption_utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
const { Array } = require('./schema/index.js');
3+
const schemaTypes = require('./schema/index.js');
44
const SchemaBigInt = require('./schema/bigint');
55
const SchemaBoolean = require('./schema/boolean');
66
const SchemaBuffer = require('./schema/buffer');
@@ -60,7 +60,7 @@ function inferBSONType(schema, path) {
6060
return 'double';
6161
}
6262

63-
if (type instanceof Array) {
63+
if (type instanceof schemaTypes.Array) {
6464
return 'array';
6565
}
6666

test/encrypted_schema.test.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,13 @@ describe('encrypted schema declaration', function() {
144144
}
145145
}
146146

147-
// Don't forget to add `Int8` to the type registry
148-
mongoose.Schema.Types.Int8 = Int8;
147+
this.beforeEach(function() {
148+
// Don't forget to add `Int8` to the type registry
149+
mongoose.Schema.Types.Int8 = Int8;
150+
});
151+
this.afterEach(function() {
152+
delete mongoose.Schema.Types.Int8;
153+
});
149154

150155
it('Then an error is thrown', function() {
151156
assert.throws(() => {

0 commit comments

Comments
 (0)