Skip to content

Commit

Permalink
Add min_duration and max_duration parameter to spotxBidAdapter (prebi…
Browse files Browse the repository at this point in the history
…d#5286)

Co-authored-by: Nick Peceniak <npeceniak@spotx.tv>
  • Loading branch information
2 people authored and iggyfisk committed Jun 22, 2020
1 parent d6e3ecd commit ea672bf
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
8 changes: 8 additions & 0 deletions modules/spotxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ export const spec = {
spotxReq.video.startdelay = 0 + Boolean(utils.getBidIdParameter('start_delay', bid.params));
}

if (utils.getBidIdParameter('min_duration', bid.params) != '') {
spotxReq.video.minduration = utils.getBidIdParameter('min_duration', bid.params);
}

if (utils.getBidIdParameter('max_duration', bid.params) != '') {
spotxReq.video.maxduration = utils.getBidIdParameter('max_duration', bid.params);
}

if (bid.crumbs && bid.crumbs.pubcid) {
pubcid = bid.crumbs.pubcid;
}
Expand Down
20 changes: 19 additions & 1 deletion test/spec/modules/spotxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ describe('the spotx adapter', function () {
price_floor: 123,
start_delay: true,
number_of_ads: 2,
spotx_all_google_consent: 1
spotx_all_google_consent: 1,
min_duration: 5,
max_duration: 10
};

bid.userId = {
Expand All @@ -169,6 +171,10 @@ describe('the spotx adapter', function () {

request = spec.buildRequests([bid], bidRequestObj)[0];
expect(request.data.id).to.equal(54321);
expect(request.data.imp.video).to.contain({
minduration: 5,
maxduration: 10
})
expect(request.data.imp.video.ext).to.deep.equal({
ad_volume: 1,
hide_skin: 1,
Expand Down Expand Up @@ -297,6 +303,18 @@ describe('the spotx adapter', function () {
expect(request.data.user.ext.consent).to.equal('consent123');
expect(request.data.regs.ext.us_privacy).to.equal('1YYY');
});

it('should pass min and max duration params', function() {
var request;

bid.params.min_duration = 3
bid.params.max_duration = 15

request = spec.buildRequests([bid], bidRequestObj)[0];

expect(request.data.imp.video.minduration).to.equal(3);
expect(request.data.imp.video.maxduration).to.equal(15);
});
});

describe('interpretResponse', function() {
Expand Down

0 comments on commit ea672bf

Please sign in to comment.