Skip to content

Commit 6238c84

Browse files
pmalouinmbroadst
authored andcommitted
fix: correctly use template string for connection string error message
1 parent 44097c2 commit 6238c84

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
@@ -510,7 +510,7 @@ function assertTlsOptionsAreEqual(optionName, queryString, queryStringKeys) {
510510
const firstValue = queryString[optionName][0];
511511
queryString[optionName].forEach(tlsValue => {
512512
if (tlsValue !== firstValue) {
513-
throw new MongoParseError('All values of ${optionName} must be the same.');
513+
throw new MongoParseError(`All values of ${optionName} must be the same.`);
514514
}
515515
});
516516
}

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)