diff --git a/src/BotDriver.js b/src/BotDriver.js index f6a01df7..e0c8bbab 100644 --- a/src/BotDriver.js +++ b/src/BotDriver.js @@ -241,8 +241,8 @@ module.exports = class BotDriver { if (_.isString(newCaps[capKey])) { try { caps[capKey] = JSON.parse(newCaps[capKey]) - if (_.isFinite(caps[capKey])) { - caps[capKey] = caps[capKey].toString() + if (_.isFinite(Number(newCaps[capKey]))) { + caps[capKey] = newCaps[capKey].toString() } } catch (err) { caps[capKey] = newCaps[capKey] diff --git a/test/driver/capabilities.spec.js b/test/driver/capabilities.spec.js index 60c2d92d..52827ddb 100644 --- a/test/driver/capabilities.spec.js +++ b/test/driver/capabilities.spec.js @@ -75,6 +75,15 @@ describe('driver.capabilities', function () { assert.isString(driver.caps.CAP_STRING_1) assert.isString(driver.caps.CAP_STRING_2) }) + it('should merge string caps when there are numbers', function () { + const myCaps = { + CAP_STRING_1: 'Test', + CAP_STRING_2: '1234567892343434344' + } + const driver = new BotDriver(myCaps) + assert.strictEqual(driver.caps.CAP_STRING_1, myCaps.CAP_STRING_1) + assert.strictEqual(driver.caps.CAP_STRING_2, myCaps.CAP_STRING_2) + }) it('should merge boolean envs', function () { process.env.BOTIUM_SIMPLEREST_PING_PROCESS_RESPONSE = 'NO' const driver = new BotDriver()