Skip to content

Commit

Permalink
ID5 User Id module - get whole ext object from server response (#10036)
Browse files Browse the repository at this point in the history
  • Loading branch information
abazylewicz-id5 authored Jun 2, 2023
1 parent 48dd8e1 commit d4a1f4f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
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

0 comments on commit d4a1f4f

Please sign in to comment.