Skip to content

Commit 24b6f41

Browse files
committed
test: add error test case
1 parent deed682 commit 24b6f41

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/integration/auth/mongodb_aws.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,30 @@ describe('MONGODB-AWS', function () {
136136
});
137137
});
138138

139+
context('when the AWS SDK is not present', function () {
140+
beforeEach(function () {
141+
if (awsSdkPresent) {
142+
this.skipReason = 'Tests error case when the AWS SDK is not installed.';
143+
return this.skip();
144+
}
145+
});
146+
147+
describe('when attempting AWS auth', function () {
148+
it('throws an error', async function () {
149+
client = this.configuration.newClient(process.env.MONGODB_URI); // use the URI built by the test environment
150+
151+
const err = await client
152+
.db('aws')
153+
.collection('aws_test')
154+
.estimatedDocumentCount()
155+
.catch(e => e);
156+
157+
expect(err).to.be.instanceof(MongoServerError);
158+
expect(err.message).to.match(/credential-providers/);
159+
});
160+
});
161+
});
162+
139163
context('when user supplies a credentials provider', function () {
140164
let providerCount = 0;
141165

0 commit comments

Comments
 (0)