Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UserId Module: add support for case insensitive submodule names #6629

Merged
merged 2 commits into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
smenzer marked this conversation as resolved.
Show resolved Hide resolved
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