Skip to content

Commit

Permalink
Add EID translation for sovrn
Browse files Browse the repository at this point in the history
  • Loading branch information
3link committed Nov 28, 2023
1 parent deff7e0 commit 36ddb80
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
16 changes: 16 additions & 0 deletions modules/liveIntentIdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ export const liveIntentIdSubmodule = {
result.pubmatic = { 'id': value.pubmatic, ext: { provider: LI_PROVIDER_DOMAIN } }
}

if (value.sovrn) {
result.sovrn = { 'id': value.sovrn, ext: { provider: LI_PROVIDER_DOMAIN } }
}

return result
}

Expand Down Expand Up @@ -348,6 +352,18 @@ export const liveIntentIdSubmodule = {
return data.ext;
}
}
},
'sovrn': {
source: 'liveintent.sovrn.com',
atype: 3,
getValue: function(data) {
return data.id;
},
getUidExt: function(data) {
if (data.ext) {
return data.ext;
}
}
}
}
};
Expand Down
34 changes: 34 additions & 0 deletions test/spec/modules/eids_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,40 @@ describe('eids array generation for known sub-modules', function() {
});
});


it('sovrn', function() {
const userId = {
sovrn: {'id': 'sample_id'}
};
const newEids = createEidsArray(userId);
expect(newEids.length).to.equal(1);
expect(newEids[0]).to.deep.equal({
source: 'liveintent.sovrn.com',
uids: [{
id: 'sample_id',
atype: 3
}]
});
});

it('sovrn with ext', function() {
const userId = {
sovrn: {'id': 'sample_id', 'ext': {'provider': 'some.provider.com'}}
};
const newEids = createEidsArray(userId);
expect(newEids.length).to.equal(1);
expect(newEids[0]).to.deep.equal({
source: 'media.net',
uids: [{
id: 'sample_id',
atype: 3,
ext: {
provider: 'liveintent.sovrn.com'
}
}]
});
});

it('magnite', function() {
const userId = {
magnite: {'id': 'sample_id'}
Expand Down
5 changes: 5 additions & 0 deletions test/spec/modules/liveIntentIdMinimalSystem_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ describe('LiveIntentMinimalId', function() {
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'medianet': 'bar'}, 'medianet': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
});

it('should decode a sovrn id to a seperate object when present', function() {
const result = liveIntentIdSubmodule.decode({ nonId: 'foo', sovrn: 'bar' });
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'sovrn': 'bar'}, 'sovrn': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
});

it('should decode a magnite id to a seperate object when present', function() {
const result = liveIntentIdSubmodule.decode({ nonId: 'foo', magnite: 'bar' });
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'magnite': 'bar'}, 'magnite': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
Expand Down
5 changes: 5 additions & 0 deletions test/spec/modules/liveIntentIdSystem_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,11 @@ describe('LiveIntentId', function() {
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'medianet': 'bar'}, 'medianet': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
});

it('should decode a sovrn id to a seperate object when present', function() {
const result = liveIntentIdSubmodule.decode({ nonId: 'foo', sovrn: 'bar' });
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'sovrn': 'bar'}, 'sovrn': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
});

it('should decode a magnite id to a seperate object when present', function() {
const result = liveIntentIdSubmodule.decode({ nonId: 'foo', magnite: 'bar' });
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'magnite': 'bar'}, 'magnite': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
Expand Down

0 comments on commit 36ddb80

Please sign in to comment.