Reorganized test and force 100% code coverage (#1226)

This commit is contained in:
Tomas Della Vedova
2020-06-15 08:37:04 +02:00
committed by delvedor
parent acce06c2af
commit 24961869cc
16 changed files with 183 additions and 30 deletions

View File

@ -22,7 +22,7 @@ const clientVersion = require('../package.json').version
const userAgent = `elasticsearch-js/${clientVersion} (${os.platform()} ${os.release()}-${os.arch()}; Node.js ${process.version})`
class Transport {
constructor (opts = {}) {
constructor (opts) {
if (typeof opts.compression === 'string' && opts.compression !== 'gzip') {
throw new ConfigurationError(`Invalid compression: '${opts.compression}'`)
}
@ -51,7 +51,6 @@ class Transport {
} else if (opts.nodeSelector === 'round-robin') {
this.nodeSelector = roundRobinSelector()
} else if (opts.nodeSelector === 'random') {
/* istanbul ignore next */
this.nodeSelector = randomSelector
} else {
this.nodeSelector = roundRobinSelector()
@ -385,7 +384,7 @@ class Transport {
}
debug('Sniffing ended successfully', result.body)
const protocol = result.meta.connection.url.protocol || 'http:'
const protocol = result.meta.connection.url.protocol || /* istanbul ignore next */ 'http:'
const hosts = this.connectionPool.nodesToHost(result.body.nodes, protocol)
this.connectionPool.update(hosts)