Skip to content

Commit

Permalink
Eids uid string only (prebid#5047)
Browse files Browse the repository at this point in the history
* added support for pubcommon, digitrust, id5id

* added support for IdentityLink

* changed the source for id5

* added unit test cases

* changed source param for identityLink

* the user-id in eid should be string only

* updated conversant bidder spec for eid-uid to be string
  • Loading branch information
pm-harshad-mane authored and iggyfisk committed Jun 22, 2020
1 parent ca329c7 commit 485829a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion modules/userId/eids.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function createEidObject(userIdData, subModuleKey) {
let eid = {};
eid.source = conf['source'];
const value = utils.isFn(conf['getValue']) ? conf['getValue'](userIdData) : userIdData;
if (value) {
if (utils.isStr(value)) {
const uid = { id: value, atype: conf['atype'] };
// getUidExt
if (utils.isFn(conf['getUidExt'])) {
Expand Down
6 changes: 3 additions & 3 deletions test/spec/modules/conversantBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,14 +470,14 @@ describe('Conversant adapter tests', function() {

// add pubcid to every entry
requests.forEach((unit) => {
Object.assign(unit, {userId: {pubcid: 112233, tdid: 223344, idl_env: 334455}});
Object.assign(unit, {userId: {pubcid: '112233', tdid: '223344', idl_env: '334455'}});
Object.assign(unit, {userIdAsEids: createEidsArray(unit.userId)});
});
// construct http post payload
const payload = spec.buildRequests(requests).data;
expect(payload).to.have.deep.nested.property('user.ext.eids', [
{source: 'adserver.org', uids: [{id: 223344, atype: 1, ext: {rtiPartner: 'TDID'}}]},
{source: 'liveramp.com', uids: [{id: 334455, atype: 1}]}
{source: 'adserver.org', uids: [{id: '223344', atype: 1, ext: {rtiPartner: 'TDID'}}]},
{source: 'liveramp.com', uids: [{id: '334455', atype: 1}]}
]);
});
});
Expand Down
22 changes: 17 additions & 5 deletions test/spec/modules/eids_spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {createEidsArray} from 'modules/userId/eids.js';
import {expect} from 'chai';

// Note: In unit tets cases for bidders, call the createEidsArray function over userId object that is used for calling fetchBids
// this way the request will stay consistent and unit test cases will not need lots of changes.
// Note: In unit tets cases for bidders, call the createEidsArray function over userId object that is used for calling fetchBids
// this way the request will stay consistent and unit test cases will not need lots of changes.

describe('eids array generation for known sub-modules', function() {
it('pubCommonId', function() {
Expand Down Expand Up @@ -158,12 +158,24 @@ describe('Negative case', function() {
expect(newEids.length).to.equal(0);
});

it('eids array generation for known sub-module with undefined value', function() {
it('eids array generation for known sub-module with non-string value', function() {
// pubCommonId
const userId = {
let userId = {
pubcid: undefined
};
const newEids = createEidsArray(userId);
let newEids = createEidsArray(userId);
expect(newEids.length).to.equal(0);
userId.pubcid = 123;
newEids = createEidsArray(userId);
expect(newEids.length).to.equal(0);
userId.pubcid = [];
newEids = createEidsArray(userId);
expect(newEids.length).to.equal(0);
userId.pubcid = {};
newEids = createEidsArray(userId);
expect(newEids.length).to.equal(0);
userId.pubcid = null;
newEids = createEidsArray(userId);
expect(newEids.length).to.equal(0);
});
});

0 comments on commit 485829a

Please sign in to comment.