Skip to content

Commit

Permalink
Merge pull request #19 from smartadserver/default-startdelay
Browse files Browse the repository at this point in the history
Update default startDelay
  • Loading branch information
krzysztofequativ authored Mar 18, 2024
2 parents a43c345 + d8d0b67 commit 93abe8c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
19 changes: 10 additions & 9 deletions modules/smartadserverBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,19 @@ 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) {
return 2;
} else if (videoMediaType.startdelay == -2) {
return 3;
} else if (videoMediaType) {
switch (videoMediaType) {
case 0:
return 1;
case -1:
return 2;
case -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
4 changes: 2 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

0 comments on commit 93abe8c

Please sign in to comment.