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

Id5Id - get whole ext object from server response #10036

Merged
merged 1 commit into from
Jun 2, 2023
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
8 changes: 3 additions & 5 deletions modules/id5IdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,19 @@ export const id5IdSubmodule = {
*/
decode(value, config) {
let universalUid;
let linkType = 0;
let ext = {};

if (value && typeof value.universal_uid === 'string') {
universalUid = value.universal_uid;
linkType = value.link_type || linkType;
ext = value.ext || ext;
} else {
return undefined;
}

let responseObj = {
id5id: {
uid: universalUid,
ext: {
linkType: linkType
}
ext: ext
}
};

Expand Down
13 changes: 10 additions & 3 deletions test/spec/modules/id5IdSystem_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,20 @@ describe('ID5 ID System', function () {
const ID5_STORED_OBJ = {
'universal_uid': ID5_STORED_ID,
'signature': ID5_STORED_SIGNATURE,
'link_type': ID5_STORED_LINK_TYPE
'ext': {
'linkType': ID5_STORED_LINK_TYPE
}
};
const ID5_RESPONSE_ID = 'newid5id';
const ID5_RESPONSE_SIGNATURE = 'abcdef';
const ID5_RESPONSE_LINK_TYPE = 2;
const ID5_JSON_RESPONSE = {
'universal_uid': ID5_RESPONSE_ID,
'signature': ID5_RESPONSE_SIGNATURE,
'link_type': ID5_RESPONSE_LINK_TYPE
'link_type': ID5_RESPONSE_LINK_TYPE,
'ext': {
'linkType': ID5_RESPONSE_LINK_TYPE
}
};
const ALLOWED_ID5_VENDOR_DATA = {
purpose: {
Expand Down Expand Up @@ -958,7 +963,9 @@ describe('ID5 ID System', function () {
it('should not expose ID when everyone is in control group', function () {
storedObject.ab_testing = {result: 'control'};
storedObject.universal_uid = '';
storedObject.link_type = 0;
storedObject.ext = {
'linkType': 0
};
let decoded = id5IdSubmodule.decode(storedObject, testConfig);
expect(decoded).is.deep.equal(expectedDecodedObjectWithoutIdAbOn);
});
Expand Down