Skip to content

Commit

Permalink
OpenX test parameter is added in order to help publishers test video …
Browse files Browse the repository at this point in the history
…inventory (#5516)

Co-authored-by: Deivydas Sabaras <>
  • Loading branch information
deivydas authored Jul 23, 2020
1 parent eb467f4 commit 9d85fde
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/openxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,10 @@ function generateVideoParameters(bid, bidderRequest) {
queryParams.vmimes = oxVideoConfig.mimes;
}

if (bid.params.test) {
queryParams.vtest = 1;
}

return queryParams;
}

Expand Down
37 changes: 37 additions & 0 deletions test/spec/modules/openxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,38 @@ describe('OpenxAdapter', function () {
expect(spec.isBidRequestValid(videoBidWithMediaType)).to.equal(false);
});
});

describe('and request config uses test', () => {
const videoBidWithTest = {
bidder: 'openx',
params: {
unit: '12345678',
delDomain: 'test-del-domain',
test: true
},
adUnitCode: 'adunit-code',
mediaTypes: {
video: {
playerSize: [640, 480]
}
},
bidId: '30b31c1838de1e',
bidderRequestId: '22edbae2733bf6',
auctionId: '1d1a030790a475',
transactionId: '4008d88a-8137-410b-aa35-fbfdabcb478e'
};

let mockBidderRequest = {refererInfo: {}};

it('should return true when required params found', function () {
expect(spec.isBidRequestValid(videoBidWithTest)).to.equal(true);
});

it('should send video bid request to openx url via GET, with vtest=1 video parameter', function () {
const request = spec.buildRequests([videoBidWithTest], mockBidderRequest);
expect(request[0].data.vtest).to.equal(1);
});
});
});
});

Expand Down Expand Up @@ -1126,6 +1158,11 @@ describe('OpenxAdapter', function () {
expect(dataParams.vwd).to.equal(640);
});

it('shouldn\'t have the test parameter', function () {
const request = spec.buildRequests(bidRequestsWithMediaTypes, mockBidderRequest);
expect(request[0].data.vtest).to.be.undefined;
});

it('should send a bc parameter', function () {
const request = spec.buildRequests(bidRequestsWithMediaTypes, mockBidderRequest);
const dataParams = request[0].data;
Expand Down

0 comments on commit 9d85fde

Please sign in to comment.