@@ -2,7 +2,7 @@ import { expect } from 'chai';
22
33/* eslint-disable @typescript-eslint/no-restricted-imports */
44import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption' ;
5- import { AWSTemporaryCredentialProvider , Binary } from '../../mongodb' ;
5+ import { AWSTemporaryCredentialProvider , Binary , MongoClient } from '../../mongodb' ;
66import { getEncryptExtraOptions } from '../../tools/utils' ;
77
88const metadata : MongoDBMetadataUI = {
@@ -53,7 +53,7 @@ describe('25. Custom AWS Credential Providers', metadata, () => {
5353 } ,
5454 credentialProviders : { aws : credentialProvider . fromNodeProviderChain ( ) }
5555 } ) ;
56- } ) . to . throw ( ) ;
56+ } ) . to . throw ( / c u s t o m c r e d e n t i a l p r o v i d e r a n d c r e d e n t i a l s / ) ;
5757 } ) ;
5858 }
5959 ) ;
@@ -84,37 +84,26 @@ describe('25. Custom AWS Credential Providers', metadata, () => {
8484 } ) ;
8585 } ) ;
8686
87- context . skip ( 'Case 3: Automatic encryption with different custom providers' , function ( ) {
88- let client ;
89-
90- beforeEach ( function ( ) {
91- client = this . configuration . newClient ( process . env . MONGODB_URI , {
92- authMechanismProperties : {
93- AWS_CREDENTIAL_PROVIDER : credentialProvider . fromNodeProviderChain ( )
94- } ,
95- autoEncryption : {
96- keyVaultNamespace : 'keyvault.datakeys' ,
97- kmsProviders : { aws : { } } ,
98- credentialProviders : {
99- aws : async ( ) => {
100- return {
101- accessKeyId : process . env . FLE_AWS_KEY ,
102- secretAccessKey : process . env . FLE_AWS_SECRET
103- } ;
87+ context (
88+ 'Case 3: Auto encryption with credentials and custom credential provider' ,
89+ metadata ,
90+ function ( ) {
91+ it ( 'throws an error' , metadata , function ( ) {
92+ expect ( ( ) => {
93+ new MongoClient ( 'mongodb://127.0.0.1:27017' , {
94+ autoEncryption : {
95+ keyVaultNamespace : 'keyvault.datakeys' ,
96+ kmsProviders : {
97+ aws : {
98+ accessKeyId : process . env . FLE_AWS_KEY ,
99+ secretAccessKey : process . env . FLE_AWS_SECRET
100+ }
101+ } ,
102+ credentialProviders : { aws : credentialProvider . fromNodeProviderChain ( ) }
104103 }
105- } ,
106- extraOptions : getEncryptExtraOptions ( )
107- }
104+ } ) ;
105+ } ) . to . throw ( / c u s t o m c r e d e n t i a l p r o v i d e r a n d c r e d e n t i a l s / ) ;
108106 } ) ;
109- } ) ;
110-
111- afterEach ( async function ( ) {
112- await client ?. close ( ) ;
113- } ) ;
114-
115- it ( 'is successful' , async function ( ) {
116- const result = await client . db ( 'test' ) . collection ( 'test' ) . insertOne ( { n : 1 } ) ;
117- expect ( result . ok ) . to . equal ( 1 ) ;
118- } ) ;
119- } ) ;
107+ }
108+ ) ;
120109} ) ;
0 commit comments