Skip to content

Commit

Permalink
UserId Module: add support for case insensitive submodule names (#6629)
Browse files Browse the repository at this point in the history
* add support for case insensitive userId names

* update unit test
  • Loading branch information
jsnellbaker authored Apr 20, 2021
1 parent 275d0f3 commit 8f6e64d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/userId/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 14 additions & 0 deletions test/spec/modules/userId_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8f6e64d

Please sign in to comment.