Skip to content

Commit

Permalink
UndertoneAdapter - change placementId parameter to optional (prebid#2649
Browse files Browse the repository at this point in the history
)

* * Update undertone adapter - change parameters - placementId parameter is now optional and not mandatory - undertoneBidAdapter.js

* Updated undertone bid adapter tests accordingly - undertoneBidAdapter_spec.js

* * Update undertone adapter - change parameters - placementId parameter is now optional and not mandatory - undertoneBidAdapter.js

 * Updated undertone bid adapter tests accordingly - undertoneBidAdapter_spec.js

* fix lint issue in undertone adapter spec
  • Loading branch information
omerko authored and AdSpacesDevelopers committed Jan 30, 2019
1 parent 644ac5f commit 34f1e2f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
4 changes: 2 additions & 2 deletions modules/undertoneBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const URL = '//hb.undertone.com/hb';
export const spec = {
code: BIDDER_CODE,
isBidRequestValid: function(bid) {
if (bid && bid.params && bid.params.publisherId && bid.params.placementId) {
if (bid && bid.params && bid.params.publisherId) {
bid.params.publisherId = parseInt(bid.params.publisherId);
return true;
}
Expand All @@ -37,7 +37,7 @@ export const spec = {
hbadaptor: 'prebid',
url: location.href,
domain: domain,
placementId: bidReq.params.placementId,
placementId: bidReq.params.placementId != undefined ? bidReq.params.placementId : null,
publisherId: bidReq.params.publisherId,
sizes: bidReq.sizes,
params: bidReq.params
Expand Down
27 changes: 21 additions & 6 deletions test/spec/modules/undertoneBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ const bidReq = [{
sizes: [[300, 250], [300, 600]],
bidId: '263be71e91dd9d',
auctionId: '9ad1fa8d-2297-4660-a018-b39945054746'
},
{
bidder: BIDDER_CODE,
params: {
publisherId: 12345
},
sizes: [[1, 1]],
bidId: '453cf42d72bb3c',
auctionId: '6c22f5a5-59df-4dc6-b92c-f433bcf0a874'
}];

const validBidRes = {
Expand Down Expand Up @@ -97,12 +106,18 @@ describe('Undertone Adapter', () => {
});
it('should have all relevant fields', () => {
const request = spec.buildRequests(bidReq);
const bid = JSON.parse(request.data)['x-ut-hb-params'][0];
expect(bid.bidRequestId).to.equal('263be71e91dd9d');
expect(bid.sizes.length > 0).to.equal(true);
expect(bid.placementId).to.equal('10433394');
expect(bid.publisherId).to.equal(12345);
expect(bid.params).to.be.an('object');
const bid1 = JSON.parse(request.data)['x-ut-hb-params'][0];
expect(bid1.bidRequestId).to.equal('263be71e91dd9d');
expect(bid1.sizes.length).to.equal(2);
expect(bid1.placementId).to.equal('10433394');
expect(bid1.publisherId).to.equal(12345);
expect(bid1.params).to.be.an('object');
const bid2 = JSON.parse(request.data)['x-ut-hb-params'][1];
expect(bid2.bidRequestId).to.equal('453cf42d72bb3c');
expect(bid2.sizes.length).to.equal(1);
expect(bid2.placementId === null).to.equal(true);
expect(bid2.publisherId).to.equal(12345);
expect(bid2.params).to.be.an('object');
});
});

Expand Down

0 comments on commit 34f1e2f

Please sign in to comment.