diff --git a/lib/core/uri_parser.js b/lib/core/uri_parser.js index 0f51e0d72e..92c9a877b8 100644 --- a/lib/core/uri_parser.js +++ b/lib/core/uri_parser.js @@ -510,7 +510,7 @@ function assertTlsOptionsAreEqual(optionName, queryString, queryStringKeys) { const firstValue = queryString[optionName][0]; queryString[optionName].forEach(tlsValue => { if (tlsValue !== firstValue) { - throw new MongoParseError('All values of ${optionName} must be the same.'); + throw new MongoParseError(`All values of ${optionName} must be the same.`); } }); } diff --git a/test/unit/core/connection_string.test.js b/test/unit/core/connection_string.test.js index 6e5c914216..f9f9cd31be 100644 --- a/test/unit/core/connection_string.test.js +++ b/test/unit/core/connection_string.test.js @@ -203,6 +203,13 @@ describe('Connection String', function() { done(); }); }); + + it('should validate non-equal tls values', function(done) { + parseConnectionString('mongodb://localhost/?tls=true&tls=false', err => { + expect(err).to.have.property('message', 'All values of tls must be the same.'); + done(); + }); + }); }); describe('spec tests', function() {