Skip to content

Commit 79347ff

Browse files
committed
test: fix non callback tests
1 parent 04602cd commit 79347ff

1 file changed

Lines changed: 13 additions & 15 deletions

File tree

test/integration/auth/mongodb_oidc.prose.test.ts

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,7 @@ describe('OIDC Auth Spec Tests', function () {
325325
if (isCallbackTest) {
326326
expect(callbackSpy).to.have.been.calledOnce;
327327
}
328-
const nextError = await collection.findOne().catch(nextError => nextError);
329-
expect(nextError).to.not.exist;
328+
await collection.findOne();
330329
if (isCallbackTest) {
331330
expect(callbackSpy).to.have.been.calledOnce;
332331
}
@@ -405,8 +404,7 @@ describe('OIDC Auth Spec Tests', function () {
405404
});
406405

407406
it('successfully authenticates', async function () {
408-
const error = await collection.findOne().catch(error => error);
409-
expect(error).to.not.exist;
407+
await collection.findOne();
410408
if (isCallbackTest) {
411409
expect(callbackSpy).to.have.been.calledTwice;
412410
}
@@ -461,8 +459,7 @@ describe('OIDC Auth Spec Tests', function () {
461459
});
462460

463461
it('successfully authenticates', async function () {
464-
const error = await collection.findOne().catch(error => error);
465-
expect(error).to.not.exist;
462+
await collection.findOne();
466463
if (isCallbackTest) {
467464
expect(callbackSpy).to.have.been.calledTwice;
468465
}
@@ -519,11 +516,11 @@ describe('OIDC Auth Spec Tests', function () {
519516
});
520517

521518
afterEach(async function () {
522-
await utilClient.db().admin().command({
519+
await utilClient?.db().admin().command({
523520
configureFailPoint: 'failCommand',
524521
mode: 'off'
525522
});
526-
await utilClient.close();
523+
await utilClient?.close();
527524
});
528525

529526
it('does not successfully authenticate', async function () {
@@ -584,11 +581,11 @@ describe('OIDC Auth Spec Tests', function () {
584581
});
585582

586583
afterEach(async function () {
587-
await utilClient.db().admin().command({
584+
await utilClient?.db().admin().command({
588585
configureFailPoint: 'failCommand',
589586
mode: 'off'
590587
});
591-
await utilClient.close();
588+
await utilClient?.close();
592589
});
593590

594591
it('does not successfully authenticate', async function () {
@@ -636,9 +633,10 @@ describe('OIDC Auth Spec Tests', function () {
636633
}
637634
});
638635

639-
const provider = client.s.authProviders.getOrCreateProvider('MONGODB-OIDC', {
640-
OIDC_CALLBACK: callbackSpy
641-
}) as MongoDBOIDC;
636+
const provider = client.s.authProviders.getOrCreateProvider(
637+
'MONGODB-OIDC',
638+
getProviderLookupProperties(callbackSpy)
639+
) as MongoDBOIDC;
642640
const token = await readFile(path.join(process.env.OIDC_TOKEN_DIR, 'test_user1'), {
643641
encoding: 'utf8'
644642
});
@@ -648,11 +646,11 @@ describe('OIDC Auth Spec Tests', function () {
648646
});
649647

650648
afterEach(async function () {
651-
await utilClient.db().admin().command({
649+
await utilClient?.db().admin().command({
652650
configureFailPoint: 'failCommand',
653651
mode: 'off'
654652
});
655-
await utilClient.close();
653+
await utilClient?.close();
656654
});
657655

658656
it('successfully authenticates', async function () {

0 commit comments

Comments
 (0)