Skip to content

Commit

Permalink
Pulling the URL check out from the logic. Whatever the user passes wi…
Browse files Browse the repository at this point in the history
…ll be used (#8473)

Co-authored-by: Jason Lydon <jason.lydon@flashtalking.com>
  • Loading branch information
ftxmoJason and Jason Lydon authored May 25, 2022
1 parent b97a0ea commit ce82891
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
7 changes: 3 additions & 4 deletions modules/ftrackIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const VENDOR_ID = null;
const LOCAL_STORAGE = 'html5';
const FTRACK_STORAGE_NAME = 'ftrackId';
const FTRACK_PRIVACY_STORAGE_NAME = `${FTRACK_STORAGE_NAME}_privacy`;
const FTRACK_URL = 'https://d9.flashtalking.com/d9core';
const storage = getStorageManager({gvlid: VENDOR_ID, moduleName: MODULE_NAME});

let consentInfo = {
Expand Down Expand Up @@ -102,7 +101,7 @@ export const ftrackIdSubmodule = {
}
}

if (config.params && config.params.url && config.params.url === FTRACK_URL) {
if (config.params && config.params.url) {
var ftrackScript = document.createElement('script');
ftrackScript.setAttribute('src', config.params.url);
window.document.body.appendChild(ftrackScript);
Expand Down Expand Up @@ -146,8 +145,8 @@ export const ftrackIdSubmodule = {
utils.logWarn(LOG_PREFIX + 'config.storage.name recommended to be "' + FTRACK_STORAGE_NAME + '".');
}

if (!config.hasOwnProperty('params') || !config.params.hasOwnProperty('url') || config.params.url !== FTRACK_URL) {
utils.logWarn(LOG_PREFIX + 'config.params.url is required for ftrack to run. Url should be "' + FTRACK_URL + '".');
if (!config.hasOwnProperty('params') || !config.params.hasOwnProperty('url')) {
utils.logWarn(LOG_PREFIX + 'config.params.url is required for ftrack to run.');
return false;
}

Expand Down
10 changes: 1 addition & 9 deletions test/spec/modules/ftrackIdSystem_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,7 @@ describe('FTRACK ID System', () => {
delete configMock1.params.url;

ftrackIdSubmodule.isConfigOk(configMock1);
expect(logWarnStub.args[0][0]).to.equal(`FTRACK - config.params.url is required for ftrack to run. Url should be "https://d9.flashtalking.com/d9core".`);
});

it(`should be rejected if 'storage.param.url' does not exist or is not 'https://d9.flashtalking.com/d9core'`, () => {
let configMock1 = JSON.parse(JSON.stringify(configMock));
configMock1.params.url = 'https://d9.NOT.flashtalking.com/d9core';

ftrackIdSubmodule.isConfigOk(configMock1);
expect(logWarnStub.args[0][0]).to.equal(`FTRACK - config.params.url is required for ftrack to run. Url should be "https://d9.flashtalking.com/d9core".`);
expect(logWarnStub.args[0][0]).to.equal(`FTRACK - config.params.url is required for ftrack to run.`);
});
});

Expand Down

0 comments on commit ce82891

Please sign in to comment.