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

CM-1020 - Add EID translation for sovrn #26

Closed
wants to merge 2 commits into from
Closed
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
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
33 changes: 33 additions & 0 deletions test/spec/modules/eids_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,39 @@ 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'}}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sovrn: {'id': 'sample_id', 'ext': {'provider': 'some.provider.com'}}
sovrn: {'id': 'sample_id', 'ext': {'provider': 'liveintent.sovrn.com'}}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be fine as is. The goal of the test is to check if the given ext.provider will be used to generate the EID. In the test we provide

'ext': {'provider': 'some.provider.com'}

thus we expect the same provider in resulting EID.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thank you.

};
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,
ext: {
provider: 'some.provider.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