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

MerkleID: add check for typof configParams.endpoint on extendId #7611

Merged
merged 5 commits into from
Oct 28, 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
5 changes: 5 additions & 0 deletions modules/merkleIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ export const merkleIdSubmodule = {
logInfo('User ID - merkleId stored id ' + storedId);
const configParams = (config && config.params) || {};

if (typeof configParams.endpoint !== 'string') {
logWarn('User ID - merkleId submodule endpoint string is not defined');
configParams.endpoint = ID_URL
}

if (consentData && typeof consentData.gdprApplies === 'boolean' && consentData.gdprApplies) {
logError('User ID - merkleId submodule does not currently handle consent strings');
return;
Expand Down
1 change: 0 additions & 1 deletion test/spec/modules/konduitWrapper_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ describe('The Konduit vast wrapper module', function () {
const callback = sinon.spy();
processBids({ bid, callback });
server.respond();

expect(server.requests.length).to.equal(1);

const requestBody = JSON.parse(server.requests[0].requestBody);
Expand Down
18 changes: 18 additions & 0 deletions test/spec/modules/merkleIdSystem_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,24 @@ describe('Merkle System', function () {

expect(id.id).to.exist.and.to.equal(storedId);
});
it('extendId() should warn on missing endpoint', function () {
let config = {
params: {
...CONFIG_PARAMS,
endpoint: undefined
},
storage: STORAGE_PARAMS
};

let yesterday = new Date(Date.now() - 86400000).toUTCString();
let storedId = {value: 'Merkle_Stored_ID', date: yesterday};

let submoduleCallback = merkleIdSubmodule.extendId(config, undefined,
storedId).callback;
submoduleCallback(callbackSpy);
expect(callbackSpy.calledOnce).to.be.true;
expect(utils.logWarn.args[0][0]).to.exist.and.to.equal('User ID - merkleId submodule endpoint string is not defined');
});

it('extendId() callback on configured storageParam.refreshInSeconds', function () {
let config = {
Expand Down