diff --git a/lib/connection_string.js b/lib/connection_string.js index b468a3b014..1aaf85f6f0 100644 --- a/lib/connection_string.js +++ b/lib/connection_string.js @@ -523,7 +523,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 3ddb05b7e2..470a9a7a33 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() {