From 8f6e64ddc9e9ba8ee0640c52179b7b1d33a4fc7a Mon Sep 17 00:00:00 2001 From: jsnellbaker <31102355+jsnellbaker@users.noreply.github.com> Date: Tue, 20 Apr 2021 12:26:20 -0400 Subject: [PATCH] UserId Module: add support for case insensitive submodule names (#6629) * add support for case insensitive userId names * update unit test --- modules/userId/index.js | 3 ++- test/spec/modules/userId_spec.js | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/userId/index.js b/modules/userId/index.js index 8822e2e11ea..8c48dcf9c7b 100644 --- a/modules/userId/index.js +++ b/modules/userId/index.js @@ -755,7 +755,8 @@ function updateSubmodules() { // find submodule and the matching configuration, if found create and append a SubmoduleContainer submodules = addedSubmodules.map(i => { - const submoduleConfig = find(configs, j => j.name === i.name); + const submoduleConfig = find(configs, j => j.name && j.name.toLowerCase() === i.name.toLowerCase()); + if (submoduleConfig && i.name !== submoduleConfig.name) submoduleConfig.name = i.name; i.findRootDomain = findRootDomain; return submoduleConfig ? { submodule: i, diff --git a/test/spec/modules/userId_spec.js b/test/spec/modules/userId_spec.js index d61d919a5ef..cad77a14075 100644 --- a/test/spec/modules/userId_spec.js +++ b/test/spec/modules/userId_spec.js @@ -513,6 +513,20 @@ describe('User ID', function () { expect(utils.logInfo.args[0][0]).to.exist.and.to.contain('User ID - usersync config updated for 1 submodules'); }); + it('handles config with name in different case', function () { + setSubmoduleRegistry([criteoIdSubmodule]); + init(config); + config.setConfig({ + userSync: { + userIds: [{ + name: 'Criteo' + }] + } + }); + + expect(utils.logInfo.args[0][0]).to.exist.and.to.contain('User ID - usersync config updated for 1 submodules'); + }); + it('config with 17 configurations should result in 18 submodules add', function () { setSubmoduleRegistry([pubCommonIdSubmodule, unifiedIdSubmodule, id5IdSubmodule, identityLinkSubmodule, liveIntentIdSubmodule, britepoolIdSubmodule, netIdSubmodule, nextrollIdSubmodule, sharedIdSubmodule, intentIqIdSubmodule, zeotapIdPlusSubmodule, haloIdSubmodule, pubProvidedIdSubmodule, criteoIdSubmodule, mwOpenLinkIdSubModule, tapadIdSubmodule, uid2IdSubmodule, admixerIdSubmodule, deepintentDpesSubmodule]); init(config);