Skip to content

Commit

Permalink
test(NODE-4556): address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Aug 19, 2022
1 parent 45e6ba7 commit 65dc4e1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
10 changes: 6 additions & 4 deletions bindings/node/test/autoEncrypter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ describe('AutoEncrypter', function () {
});

describe('#constructor', function () {
// This case is driver 4.9.0 and higher.
context('when mongodb exports BSON', function () {
context('when mongodb exports BSON (driver >= 4.9.0)', function () {
context('when a bson option is provided', function () {
const bson = Object.assign({}, BSON);
const encrypter = new AutoEncrypter(
Expand Down Expand Up @@ -144,10 +143,13 @@ describe('AutoEncrypter', function () {
expect(encrypter._bson).to.equal(BSON);
});
});

it('never uses bson from the topology', function () {
expect(() => new AutoEncrypter({}, {})).not.to.throw();
});
});

// This case is driver < 4.9.0.
context('when mongodb does not export BSON', function () {
context('when mongodb does not export BSON (driver < 4.9.0)', function () {
context('when a bson option is provided', function () {
const bson = Object.assign({}, BSON);
const encrypter = new AutoEncrypter(
Expand Down
20 changes: 16 additions & 4 deletions bindings/node/test/clientEncryption.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ describe('ClientEncryption', function () {
}

describe('#constructor', function () {
// This case is driver 4.9.0 and higher.
context('when mongodb exports BSON', function () {
context('when mongodb exports BSON (driver >= 4.9.0)', function () {
context('when a bson option is provided', function () {
const bson = Object.assign({}, BSON);
const encrypter = new ClientEncryption(
Expand Down Expand Up @@ -98,10 +97,23 @@ describe('ClientEncryption', function () {
expect(encrypter._bson).to.equal(BSON);
});
});

it('never uses bson from the topology', function () {
expect(() => {
new ClientEncryption(
{},
{
keyVaultNamespace: 'client.encryption',
kmsProviders: {
local: { key: Buffer.alloc(96) }
}
}
)
}).not.to.throw();
});
});

// This case is driver < 4.9.0.
context('when mongodb does not export BSON', function () {
context('when mongodb does not export BSON (driver < 4.9.0)', function () {
context('when a bson option is provided', function () {
const bson = Object.assign({}, BSON);
const encrypter = new ClientEncryption(
Expand Down

0 comments on commit 65dc4e1

Please sign in to comment.