Skip to content

Commit 814e278

Browse files
pmalouinmbroadst
authored andcommitted
fix: correctly use template string for connection string error message
1 parent 96e5426 commit 814e278

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/core/uri_parser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ function assertTlsOptionsAreEqual(optionName, queryString, queryStringKeys) {
523523
const firstValue = queryString[optionName][0];
524524
queryString[optionName].forEach(tlsValue => {
525525
if (tlsValue !== firstValue) {
526-
throw new MongoParseError('All values of ${optionName} must be the same.');
526+
throw new MongoParseError(`All values of ${optionName} must be the same.`);
527527
}
528528
});
529529
}

test/unit/core/connection_string.test.js

+7
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,13 @@ describe('Connection String', function() {
203203
done();
204204
});
205205
});
206+
207+
it('should validate non-equal tls values', function(done) {
208+
parseConnectionString('mongodb://localhost/?tls=true&tls=false', err => {
209+
expect(err).to.have.property('message', 'All values of tls must be the same.');
210+
done();
211+
});
212+
});
206213
});
207214

208215
describe('spec tests', function() {

0 commit comments

Comments
 (0)