Skip to content

Commit

Permalink
fix some video request params (#5799)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertrmartinez authored Oct 5, 2020
1 parent ca22a45 commit 664ec3b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
4 changes: 2 additions & 2 deletions modules/rubiconBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ export const spec = {
source: {
tid: bidRequest.transactionId
},
tmax: config.getConfig('TTL') || 1000,
tmax: bidderRequest.timeout,
imp: [{
exp: 300,
exp: config.getConfig('s2sConfig.defaultTtl'),
id: bidRequest.adUnitCode,
secure: 1,
ext: {
Expand Down
36 changes: 33 additions & 3 deletions test/spec/modules/rubiconBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1381,11 +1381,11 @@ describe('the rubicon adapter', function () {
let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
let post = request.data;

expect(post).to.have.property('imp')
expect(post).to.have.property('imp');
// .with.length.of(1);
let imp = post.imp[0];
expect(imp.id).to.equal(bidderRequest.bids[0].adUnitCode);
expect(imp.exp).to.equal(300);
expect(imp.exp).to.equal(undefined); // now undefined
expect(imp.video.w).to.equal(640);
expect(imp.video.h).to.equal(480);
expect(imp.video.pos).to.equal(1);
Expand Down Expand Up @@ -1542,6 +1542,36 @@ describe('the rubicon adapter', function () {
expect(request.data.imp[0].ext).to.not.haveOwnProperty('rubicon');
});

it('should send video exp param correctly when set', function () {
createVideoBidderRequest();
config.setConfig({s2sConfig: {defaultTtl: 600}});
let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
let post = request.data;

// should exp set to the right value according to config
let imp = post.imp[0];
expect(imp.exp).to.equal(600);
});

it('should not send video exp at all if not set in s2sConfig config', function () {
createVideoBidderRequest();
let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
let post = request.data;

// should exp set to the right value according to config
let imp = post.imp[0];
// bidderFactory stringifies request body before sending so removes undefined attributes:
expect(imp.exp).to.equal(undefined);
});

it('should send tmax as the bidderRequest timeout value', function () {
createVideoBidderRequest();
bidderRequest.timeout = 3333;
let [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
let post = request.data;
expect(post.tmax).to.equal(3333);
});

it('should send correct bidfloor to PBS', function () {
createVideoBidderRequest();

Expand Down Expand Up @@ -1891,7 +1921,7 @@ describe('the rubicon adapter', function () {
// .with.length.of(1);
let imp = post.imp[0];
expect(imp.id).to.equal(bidderRequest.bids[0].adUnitCode);
expect(imp.exp).to.equal(300);
expect(imp.exp).to.equal(undefined);
expect(imp.video.w).to.equal(640);
expect(imp.video.h).to.equal(480);
expect(imp.video.pos).to.equal(1);
Expand Down

0 comments on commit 664ec3b

Please sign in to comment.