Skip to content

Commit 517a31b

Browse files
test(NODE-3218): Consistent error message for connection string parsing (#3291)
1 parent 30f6a52 commit 517a31b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

test/unit/connection_string.test.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,15 @@ describe('Connection String', function () {
382382

383383
describe('validation', function () {
384384
it('should validate compressors options', function () {
385-
expect(() => parseOptions('mongodb://localhost/?compressors=bunnies')).to.throw(
386-
MongoInvalidArgumentError,
387-
'bunnies is not a valid compression mechanism'
385+
let thrownError;
386+
try {
387+
parseOptions('mongodb://localhost/?compressors=bunnies');
388+
} catch (error) {
389+
thrownError = error;
390+
}
391+
expect(thrownError).to.be.instanceOf(MongoInvalidArgumentError);
392+
expect(thrownError.message).to.equal(
393+
'bunnies is not a valid compression mechanism. Must be one of: none,snappy,zlib,zstd.'
388394
);
389395
});
390396

0 commit comments

Comments
 (0)