From f0acf9c3d64af2f868d3adf34f4d146fcdefc378 Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Wed, 9 Feb 2022 21:55:24 +0100 Subject: [PATCH] test(NODE-2938): minor test fixes --- test/manual/kerberos.test.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/manual/kerberos.test.js b/test/manual/kerberos.test.js index 4650f06735d..5e09be9502f 100644 --- a/test/manual/kerberos.test.js +++ b/test/manual/kerberos.test.js @@ -97,7 +97,7 @@ describe('Kerberos', function () { }); }); - context('when passsing SERVICE_HOST', function () { + context('when passing SERVICE_HOST as an auth mech option', function () { context('when the SERVICE_HOST is invalid', function () { const client = new MongoClient(`${krb5Uri}&maxPoolSize=1`, { authMechanismProperties: { @@ -105,10 +105,13 @@ describe('Kerberos', function () { } }); - it('fails to authenticate', function () { - return client.connect().catch(e => { - expect(e).to.exist; - }); + it('fails to authenticate', async function () { + let expectedError; + await client.connect().catch(e => { expectedError = e }); + if (!expectedError) { + expect.fail('Expected connect with invalid SERVICE_HOST to fail'); + } + expect(expectedError).property('message').to.include('Authentication failed'); }); });