@@ -61,23 +61,32 @@ describe('MONGODB-AWS', function () {
61
61
expect ( result ) . to . be . a ( 'number' ) ;
62
62
} ) ;
63
63
64
- it ( 'authenticates with a user provided credentials provider' , async function ( ) {
65
- // @ts -expect-error We intentionally access a protected variable.
66
- const credentialProvider = AWSTemporaryCredentialProvider . awsSDK ;
67
- client = this . configuration . newClient ( process . env . MONGODB_URI , {
68
- authMechanismProperties : {
69
- AWS_CREDENTIAL_PROVIDER : credentialProvider . fromNodeProviderChain ( )
64
+ context ( 'when user supplies a credentials provider' , function ( ) {
65
+ beforeEach ( function ( ) {
66
+ if ( ! awsSdkPresent ) {
67
+ this . skipReason = 'only relevant to AssumeRoleWithWebIdentity with SDK installed' ;
68
+ return this . skip ( ) ;
70
69
}
71
70
} ) ;
72
71
73
- const result = await client
74
- . db ( 'aws' )
75
- . collection ( 'aws_test' )
76
- . estimatedDocumentCount ( )
77
- . catch ( error => error ) ;
72
+ it ( 'authenticates with a user provided credentials provider' , async function ( ) {
73
+ // @ts -expect-error We intentionally access a protected variable.
74
+ const credentialProvider = AWSTemporaryCredentialProvider . awsSDK ;
75
+ client = this . configuration . newClient ( process . env . MONGODB_URI , {
76
+ authMechanismProperties : {
77
+ AWS_CREDENTIAL_PROVIDER : credentialProvider . fromNodeProviderChain ( )
78
+ }
79
+ } ) ;
78
80
79
- expect ( result ) . to . not . be . instanceOf ( MongoServerError ) ;
80
- expect ( result ) . to . be . a ( 'number' ) ;
81
+ const result = await client
82
+ . db ( 'aws' )
83
+ . collection ( 'aws_test' )
84
+ . estimatedDocumentCount ( )
85
+ . catch ( error => error ) ;
86
+
87
+ expect ( result ) . to . not . be . instanceOf ( MongoServerError ) ;
88
+ expect ( result ) . to . be . a ( 'number' ) ;
89
+ } ) ;
81
90
} ) ;
82
91
83
92
it ( 'should allow empty string in authMechanismProperties.AWS_SESSION_TOKEN to override AWS_SESSION_TOKEN environment variable' , function ( ) {
0 commit comments