From 4fea046f4d2a1878587be4f245db94e1855be7fa Mon Sep 17 00:00:00 2001 From: Brian Clifton Date: Mon, 29 Aug 2016 12:14:18 -0700 Subject: [PATCH] Update getActivePasswordManager call to call getSettings (which provides a default). Fixes: https://github.com/brave/browser-laptop/issues/3549 Auditors: @bbondy --- js/settings.js | 2 +- test/unit/settingsTest.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/js/settings.js b/js/settings.js index faa28e1e07e..6671ea69e07 100644 --- a/js/settings.js +++ b/js/settings.js @@ -48,7 +48,7 @@ module.exports.getSetting = (settingKey, settingsCollection) => { } module.exports.getActivePasswordManager = (settingsCollection) => { - const passwordManager = resolveValue(settings.ACTIVE_PASSWORD_MANAGER, settingsCollection) + const passwordManager = module.exports.getSetting(settings.ACTIVE_PASSWORD_MANAGER, settingsCollection) let details = { name: passwordManager, diff --git a/test/unit/settingsTest.js b/test/unit/settingsTest.js index c6e70d04a24..7e056bb3ec8 100644 --- a/test/unit/settingsTest.js +++ b/test/unit/settingsTest.js @@ -111,5 +111,16 @@ describe('settings unit test', function () { const actualResult = settings.getActivePasswordManager(settingsCollection) assert.deepEqual(actualResult, expectedResult) }) + + it('calls getSetting to get the value (providing a default if none exists)', function () { + settingsCollection[settingsConst.ONE_PASSWORD_ENABLED] = true + const expectedResult = Immutable.fromJS({ + name: passwordManagers.ONE_PASSWORD, + extensionId: extensionIds[passwordManagers.ONE_PASSWORD], + displayName: displayNames[passwordManagers.ONE_PASSWORD] + }) + const actualResult = settings.getActivePasswordManager(settingsCollection) + assert.deepEqual(actualResult, expectedResult) + }) }) })