Skip to content

Commit

Permalink
OpenX should run only banner auction if it is multi format solution (p…
Browse files Browse the repository at this point in the history
  • Loading branch information
deivydas authored and Alex committed Aug 1, 2019
1 parent 6aad3f3 commit 7f2addd
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/openxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const spec = {
};

function isVideoRequest(bidRequest) {
return utils.deepAccess(bidRequest, 'mediaTypes.video') || bidRequest.mediaType === VIDEO;
return (utils.deepAccess(bidRequest, 'mediaTypes.video') && !utils.deepAccess(bidRequest, 'mediaTypes.banner')) || bidRequest.mediaType === VIDEO;
}

function createBannerBidResponses(oxResponseObj, {bids, startTime}) {
Expand Down
35 changes: 35 additions & 0 deletions test/spec/modules/openxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,41 @@ describe('OpenxAdapter', function () {
});
});

describe('when request is for a multiformat ad', function () {
describe('and request config uses mediaTypes video and banner', () => {
const multiformatBid = {
bidder: 'openx',
params: {
unit: '12345678',
delDomain: 'test-del-domain'
},
adUnitCode: 'adunit-code',
mediaTypes: {
banner: {
sizes: [[300, 250]]
},
video: {
playerSize: [300, 250]
}
},
bidId: '30b31c1838de1e',
bidderRequestId: '22edbae2733bf6',
auctionId: '1d1a030790a475',
transactionId: '4008d88a-8137-410b-aa35-fbfdabcb478e'
};
it('should return true multisize when required params found', function () {
expect(spec.isBidRequestValid(multiformatBid)).to.equal(true);
});

it('should send bid request to openx url via GET, with mediaType specified as banner', function () {
const request = spec.buildRequests([multiformatBid]);
expect(request[0].url).to.equal(`//${multiformatBid.params.delDomain}${URLBASE}`);
expect(request[0].data.ph).to.be.undefined;
expect(request[0].method).to.equal('GET');
});
});
});

describe('when request is for a video ad', function () {
describe('and request config uses mediaTypes', () => {
const videoBidWithMediaTypes = {
Expand Down

0 comments on commit 7f2addd

Please sign in to comment.