diff --git a/src/operations/map_reduce.ts b/src/operations/map_reduce.ts index d89bb5202f4..5786b9a6a4c 100644 --- a/src/operations/map_reduce.ts +++ b/src/operations/map_reduce.ts @@ -8,7 +8,7 @@ import { Callback, maxWireVersion } from '../utils'; -import { ReadPreference, ReadPreferenceMode } from '../read_preference'; +import { ReadPreference } from '../read_preference'; import { CommandOperation, CommandOperationOptions } from './command'; import type { Server } from '../sdam/server'; import type { Collection } from '../collection'; diff --git a/test/unit/core/connection_string.test.js b/test/unit/core/connection_string.test.js index 40d9ff0d9c5..b61e649234d 100644 --- a/test/unit/core/connection_string.test.js +++ b/test/unit/core/connection_string.test.js @@ -220,72 +220,72 @@ describe('Connection String', function () { suites.forEach(suite => { describe(suite.name, function () { suite.tests.forEach(test => { - // it(test.description, { - // metadata: { requires: { topology: 'single' } }, - // test: function (done) { - // if (skipTests.indexOf(test.description) !== -1) { - // return this.skip(); - // } - - // const valid = test.valid; - // parseConnectionString(test.uri, { caseTranslate: false }, function (err, result) { - // if (valid === false) { - // expect(err).to.exist; - // expect(err).to.be.instanceOf(MongoParseError); - // expect(result).to.not.exist; - // } else { - // expect(err).to.not.exist; - // expect(result).to.exist; - - // // remove data we don't track - // if (test.auth && test.auth.password === '') { - // test.auth.password = null; - // } - - // if (test.hosts != null) { - // test.hosts = test.hosts.map(host => { - // delete host.type; - // host.host = punycode.toASCII(host.host); - // return host; - // }); - - // // remove values that require no validation - // test.hosts.forEach(host => { - // Object.keys(host).forEach(key => { - // if (host[key] == null) delete host[key]; - // }); - // }); - - // expect(result.hosts).to.containSubset(test.hosts); - // } - - // if (test.auth) { - // if (test.auth.db != null) { - // expect(result.auth).to.have.property('db'); - // expect(result.auth.db).to.eql(test.auth.db); - // } - - // if (test.auth.username != null) { - // expect(result.auth).to.have.property('username'); - // expect(result.auth.username).to.eql(test.auth.username); - // } - - // if (test.auth.password != null) { - // expect(result.auth).to.have.property('password'); - // expect(result.auth.password).to.eql(test.auth.password); - // } - // } - - // if (test.options != null) { - // // it's possible we have options which are not explicitly included in the spec test - // expect(result.options).to.deep.include(test.options); - // } - // } - - // done(); - // }); - // } - // }); + it(test.description, { + metadata: { requires: { topology: 'single' } }, + test: function (done) { + if (skipTests.indexOf(test.description) !== -1) { + return this.skip(); + } + + const valid = test.valid; + parseConnectionString(test.uri, { caseTranslate: false }, function (err, result) { + if (valid === false) { + expect(err).to.exist; + expect(err).to.be.instanceOf(MongoParseError); + expect(result).to.not.exist; + } else { + expect(err).to.not.exist; + expect(result).to.exist; + + // remove data we don't track + if (test.auth && test.auth.password === '') { + test.auth.password = null; + } + + if (test.hosts != null) { + test.hosts = test.hosts.map(host => { + delete host.type; + host.host = punycode.toASCII(host.host); + return host; + }); + + // remove values that require no validation + test.hosts.forEach(host => { + Object.keys(host).forEach(key => { + if (host[key] == null) delete host[key]; + }); + }); + + expect(result.hosts).to.containSubset(test.hosts); + } + + if (test.auth) { + if (test.auth.db != null) { + expect(result.auth).to.have.property('db'); + expect(result.auth.db).to.eql(test.auth.db); + } + + if (test.auth.username != null) { + expect(result.auth).to.have.property('username'); + expect(result.auth.username).to.eql(test.auth.username); + } + + if (test.auth.password != null) { + expect(result.auth).to.have.property('password'); + expect(result.auth.password).to.eql(test.auth.password); + } + } + + if (test.options != null) { + // it's possible we have options which are not explicitly included in the spec test + expect(result.options).to.deep.include(test.options); + } + } + + done(); + }); + } + }); it(`${test.description} -- new MongoOptions parser`, function () { if (skipTests.includes(test.description)) {