Skip to content

Commit

Permalink
Smartadserver Bid Adapter: Update default value of startDelay video p…
Browse files Browse the repository at this point in the history
…arameter (#11225)

* Smartadserver Bid Adapter: Add support for SDA user and site

* Smartadserver Bid Adapter: Fix SDA support getConfig and add to unit testing

* support floors per media type

* Add GPP support

* Rework payloads enriching

* Add gpid support

* Support additional video params

* vpmt as array of numbers

* Fix comment

* Update default startDelay

* Include videoMediaType's startdelay

* Handle specified midroll

---------

Co-authored-by: Meven Courouble <mcourouble@smartadserver.com>
Co-authored-by: Krzysztof Sokół <88041828+smart-adserver@users.noreply.github.com>
Co-authored-by: Dariusz O <darekodz@gmail.com>
  • Loading branch information
4 people authored Apr 3, 2024
1 parent c27f64b commit 74a404c
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 8 deletions.
10 changes: 4 additions & 6 deletions modules/smartadserverBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,16 @@ export const spec = {
* @returns positive integer value of startdelay
*/
getStartDelayForVideoBidRequest: function(videoMediaType, videoParams) {
if (videoParams !== undefined && videoParams.startDelay) {
if (videoParams?.startDelay) {
return videoParams.startDelay;
} else if (videoMediaType !== undefined) {
if (videoMediaType.startdelay == 0) {
return 1;
} else if (videoMediaType.startdelay == -1) {
} else if (videoMediaType?.startdelay) {
if (videoMediaType.startdelay > 0 || videoMediaType.startdelay == -1) {
return 2;
} else if (videoMediaType.startdelay == -2) {
return 3;
}
}
return 2;// Default value for all exotic cases set to bid.params.video.startDelay midroll hence 2.
return 1; // SADR-5619
},

/**
Expand Down
48 changes: 46 additions & 2 deletions test/spec/modules/smartadserverBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ describe('Smart bid adapter tests', function () {
const requestContent = JSON.parse(request[0].data);
expect(requestContent).to.have.property('videoData');
expect(requestContent.videoData).not.to.have.property('videoProtocol').eq(true);
expect(requestContent.videoData).to.have.property('adBreak').and.to.equal(2);
expect(requestContent.videoData).to.have.property('adBreak').and.to.equal(1);
});

it('Verify videoData params override meta values', function () {
Expand Down Expand Up @@ -1097,7 +1097,7 @@ describe('Smart bid adapter tests', function () {
const requestContent = JSON.parse(request[0].data);
expect(requestContent).to.have.property('videoData');
expect(requestContent.videoData).not.to.have.property('videoProtocol').eq(true);
expect(requestContent.videoData).to.have.property('adBreak').and.to.equal(2);
expect(requestContent.videoData).to.have.property('adBreak').and.to.equal(1);
});

it('Verify videoData params override meta values', function () {
Expand Down Expand Up @@ -1143,6 +1143,50 @@ describe('Smart bid adapter tests', function () {
expect(requestContent.videoData).to.have.property('videoProtocol').and.to.equal(6);
expect(requestContent.videoData).to.have.property('adBreak').and.to.equal(3);
});

it('should handle value of videoMediaType.startdelay', function () {
const request = spec.buildRequests([{
bidder: 'smartadserver',
mediaTypes: {
video: {
context: 'outstream',
playerSize: [[640, 480]],
startdelay: -2
}
},
params: {
siteId: 123,
pageId: 456,
formatId: 78
}
}]);

const requestContent = JSON.parse(request[0].data);
expect(requestContent).to.have.property('videoData');
expect(requestContent.videoData).to.have.property('adBreak').and.to.equal(3);
});

it('should return specified value of videoMediaType.startdelay', function () {
const request = spec.buildRequests([{
bidder: 'smartadserver',
mediaTypes: {
video: {
context: 'outstream',
playerSize: [[640, 480]],
startdelay: 60
}
},
params: {
siteId: 123,
pageId: 456,
formatId: 78
}
}]);

const requestContent = JSON.parse(request[0].data);
expect(requestContent).to.have.property('videoData');
expect(requestContent.videoData).to.have.property('adBreak').and.to.equal(2);
});
});

describe('External ids tests', function () {
Expand Down

0 comments on commit 74a404c

Please sign in to comment.