Skip to content

Commit

Permalink
fix: correctly use template string for connection string error message
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalouin committed Mar 10, 2020
1 parent eed1131 commit b4d89ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/connection_string.js
Expand Up @@ -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.`);
}
});
}
Expand Down
7 changes: 7 additions & 0 deletions test/unit/core/connection_string.test.js
Expand Up @@ -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() {
Expand Down

0 comments on commit b4d89ea

Please sign in to comment.