Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insticator Bid Adapter : update adapter for deprecated placement field #11600

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions modules/insticatorBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function buildVideo(bidRequest) {
let w = deepAccess(bidRequest, 'mediaTypes.video.w');
let h = deepAccess(bidRequest, 'mediaTypes.video.h');
const mimes = deepAccess(bidRequest, 'mediaTypes.video.mimes');
const placement = deepAccess(bidRequest, 'mediaTypes.video.placement') || 3;
const placement = deepAccess(bidRequest, 'mediaTypes.video.placement');
const plcmt = deepAccess(bidRequest, 'mediaTypes.video.plcmt') || undefined;
const playerSize = deepAccess(bidRequest, 'mediaTypes.video.playerSize');
const context = deepAccess(bidRequest, 'mediaTypes.video.context');
Expand Down Expand Up @@ -136,6 +136,10 @@ function buildVideo(bidRequest) {
}
}

if (placement && typeof placement !== 'undefined' && typeof placement === 'number') {
optionalParams['placement'] = placement;
}

if (plcmt) {
optionalParams['plcmt'] = plcmt;
}
Expand All @@ -145,7 +149,6 @@ function buildVideo(bidRequest) {
}

let videoObj = {
placement,
mimes,
w,
h,
Expand Down Expand Up @@ -595,13 +598,6 @@ function validateVideo(bid) {
return false;
}

const placement = deepAccess(bid, 'mediaTypes.video.placement');

if (typeof placement !== 'undefined' && typeof placement !== 'number') {
logError('insticator: video placement is not a number');
return false;
}

const plcmt = deepAccess(bid, 'mediaTypes.video.plcmt');

if (typeof plcmt !== 'undefined' && typeof plcmt !== 'number') {
Expand Down
25 changes: 3 additions & 22 deletions test/spec/modules/insticatorBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,25 +175,6 @@ describe('InsticatorBidAdapter', function () {
})).to.be.true;
})

it('should return false if video placement is not a number', () => {
expect(spec.isBidRequestValid({
...bidRequest,
...{
mediaTypes: {
video: {
mimes: [
'video/mp4',
'video/mpeg',
],
w: 250,
h: 300,
placement: 'NaN',
},
}
}
})).to.be.false;
});

it('should return false if video plcmt is not a number', () => {
expect(spec.isBidRequestValid({
...bidRequest,
Expand Down Expand Up @@ -224,7 +205,7 @@ describe('InsticatorBidAdapter', function () {
'video/mpeg',
],
playerSize: [250, 300],
placement: 1,
plcmt: 1,
},
}
}
Expand Down Expand Up @@ -293,7 +274,7 @@ describe('InsticatorBidAdapter', function () {
'video/mpeg',
],
playerSize: [250, 300],
placement: 1,
plcmt: 1,
},
}
},
Expand All @@ -306,7 +287,7 @@ describe('InsticatorBidAdapter', function () {
'video/x-flv',
'video/webm',
],
placement: 2,
plcmt: 2,
},
}
})).to.be.true;
Expand Down