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

Limelight Bid Adapter: add field user id as eids to payload #7858

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
3 changes: 2 additions & 1 deletion modules/limelightDigitalBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ function buildPlacement(bidRequest) {
}
}),
type: bidRequest.params.adUnitType.toUpperCase(),
publisherId: bidRequest.params.publisherId
publisherId: bidRequest.params.publisherId,
userIdAsEids: bidRequest.userIdAsEids
}
}
}
92 changes: 75 additions & 17 deletions test/spec/modules/limelightDigitalBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,17 @@ describe('limelightDigitalAdapter', function () {
sizes: [[300, 250]]
}
},
transactionId: '3bb2f6da-87a6-4029-aeb0-bfe951372e62'
transactionId: '3bb2f6da-87a6-4029-aeb0-bfe951372e62',
userIdAsEids: [
{
source: 'test1.org',
uids: [
{
id: '123',
}
]
}
]
}
const bid2 = {
bidId: '58ee9870c3164a',
Expand All @@ -33,7 +43,17 @@ describe('limelightDigitalAdapter', function () {
placementCode: 'placement_1',
auctionId: '482f88de-29ab-45c8-981a-d25e39454a34',
sizes: [[350, 200]],
transactionId: '068867d1-46ec-40bb-9fa0-e24611786fb4'
transactionId: '068867d1-46ec-40bb-9fa0-e24611786fb4',
userIdAsEids: [
{
source: 'test2.org',
uids: [
{
id: '234',
}
]
}
]
}
const bid3 = {
bidId: '019645c7d69460',
Expand All @@ -48,7 +68,20 @@ describe('limelightDigitalAdapter', function () {
placementCode: 'placement_2',
auctionId: 'e4771143-6aa7-41ec-8824-ced4342c96c8',
sizes: [[800, 600]],
transactionId: '738d5915-6651-43b9-9b6b-d50517350917'
transactionId: '738d5915-6651-43b9-9b6b-d50517350917',
userIdAsEids: [
{
source: 'test3.org',
uids: [
{
id: '345',
},
{
id: '456',
}
]
}
]
}
const bid4 = {
bidId: '019645c7d69460',
Expand All @@ -64,7 +97,17 @@ describe('limelightDigitalAdapter', function () {
video: {
playerSize: [800, 600]
},
transactionId: '738d5915-6651-43b9-9b6b-d50517350917'
transactionId: '738d5915-6651-43b9-9b6b-d50517350917',
userIdAsEids: [
{
source: 'test.org',
uids: [
{
id: '111',
}
]
}
]
}

describe('buildRequests', function () {
Expand All @@ -84,19 +127,33 @@ describe('limelightDigitalAdapter', function () {
expect(serverRequest.method).to.equal('POST')
})
it('Returns valid data if array of bids is valid', function () {
let data = serverRequest.data
expect(data).to.be.an('object')
expect(data).to.have.all.keys('deviceWidth', 'deviceHeight', 'secure', 'adUnits')
expect(data.deviceWidth).to.be.a('number')
expect(data.deviceHeight).to.be.a('number')
expect(data.secure).to.be.a('boolean')
let data = serverRequest.data;
expect(data).to.be.an('object');
expect(data).to.have.all.keys(
'deviceWidth',
'deviceHeight',
'secure',
'adUnits'
);
expect(data.deviceWidth).to.be.a('number');
expect(data.deviceHeight).to.be.a('number');
expect(data.secure).to.be.a('boolean');
data.adUnits.forEach(adUnit => {
expect(adUnit).to.have.all.keys('id', 'bidId', 'type', 'sizes', 'transactionId', 'publisherId')
expect(adUnit.id).to.be.a('number')
expect(adUnit.bidId).to.be.a('string')
expect(adUnit.type).to.be.a('string')
expect(adUnit.transactionId).to.be.a('string')
expect(adUnit.sizes).to.be.an('array')
expect(adUnit).to.have.all.keys(
'id',
'bidId',
'type',
'sizes',
'transactionId',
'publisherId',
'userIdAsEids'
);
expect(adUnit.id).to.be.a('number');
expect(adUnit.bidId).to.be.a('string');
expect(adUnit.type).to.be.a('string');
expect(adUnit.transactionId).to.be.a('string');
expect(adUnit.sizes).to.be.an('array');
expect(adUnit.userIdAsEids).to.be.an('array');
})
})
})
Expand Down Expand Up @@ -194,7 +251,7 @@ describe('limelightDigitalAdapter', function () {
expect(dataItem.meta.advertiserDomains).to.be.an('array');
expect(dataItem.meta.mediaType).to.be.a('string');
}
it('Returns an empty array if invalid response is passed', function () {
it('should return an empty array if invalid response is passed', function () {
serverResponses = spec.interpretResponse('invalid_response');
expect(serverResponses).to.be.an('array').that.is.empty;
});
Expand Down Expand Up @@ -481,4 +538,5 @@ function validateAdUnit(adUnit, bid) {
}
}));
expect(adUnit.publisherId).to.equal(bid.params.publisherId);
expect(adUnit.userIdAsEids).to.deep.equal(bid.userIdAsEids);
}