Skip to content

Commit

Permalink
Remove the placement parameter and update test cases accordingly, Add…
Browse files Browse the repository at this point in the history
… plcmt parameter.
  • Loading branch information
pm-nitin-shirsat committed May 23, 2024
1 parent 9fc89c6 commit 70b6e36
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
8 changes: 4 additions & 4 deletions modules/pubmaticBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const DEFAULT_HEIGHT = 0;
const PREBID_NATIVE_HELP_LINK = 'http://prebid.org/dev-docs/show-native-ads.html';
const PUBLICATION = 'pubmatic'; // Your publication on Blue Billywig, potentially with environment (e.g. publication.bbvms.com or publication.test.bbvms.com)
const RENDERER_URL = 'https://pubmatic.bbvms.com/r/'.concat('$RENDERER', '.js'); // URL of the renderer application
const MSG_VIDEO_PLACEMENT_MISSING = 'Video.Placement param missing';
const MSG_VIDEO_PLCMT_MISSING = 'Video.plcmt param missing';

const CUSTOM_PARAMS = {
'kadpageurl': '', // Custom page url
Expand Down Expand Up @@ -56,7 +56,7 @@ const VIDEO_CUSTOM_PARAMS = {
'h': DATA_TYPES.NUMBER,
'battr': DATA_TYPES.ARRAY,
'linearity': DATA_TYPES.NUMBER,
'placement': DATA_TYPES.NUMBER,
// 'placement': DATA_TYPES.NUMBER,
'plcmt': DATA_TYPES.NUMBER,
'minbitrate': DATA_TYPES.NUMBER,
'maxbitrate': DATA_TYPES.NUMBER,
Expand Down Expand Up @@ -560,8 +560,8 @@ function _createBannerRequest(bid) {

export function checkVideoPlacement(videoData, adUnitCode) {
// Check for video.placement property. If property is missing display log message.
if (FEATURES.VIDEO && !deepAccess(videoData, 'placement')) {
logWarn(MSG_VIDEO_PLACEMENT_MISSING + ' for ' + adUnitCode);
if (FEATURES.VIDEO && !deepAccess(videoData, 'plcmt')) {
logWarn(MSG_VIDEO_PLCMT_MISSING + ' for ' + adUnitCode);
};
}

Expand Down
18 changes: 8 additions & 10 deletions test/spec/modules/pubmaticBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('PubMatic adapter', function () {
protocols: [2, 3],
battr: [13, 14],
linearity: 1,
placement: 2,
// plcmt: 2,
plcmt: 1,
minbitrate: 10,
maxbitrate: 10
Expand Down Expand Up @@ -169,7 +169,7 @@ describe('PubMatic adapter', function () {
h: 480,
battr: [13, 14],
linearity: 1,
placement: 2,
// plcmt: 2,
plcmt: 1,
minbitrate: 100,
maxbitrate: 4096
Expand Down Expand Up @@ -394,7 +394,7 @@ describe('PubMatic adapter', function () {
h: 480,
battr: [13, 14],
linearity: 1,
placement: 2,
// plcmt: 2,
plcmt: 1,
minbitrate: 100,
maxbitrate: 4096
Expand Down Expand Up @@ -522,7 +522,7 @@ describe('PubMatic adapter', function () {
h: 480,
battr: [13, 14],
linearity: 1,
placement: 2,
// plcmt: 2,
plcmt: 1,
minbitrate: 100,
maxbitrate: 4096
Expand Down Expand Up @@ -593,7 +593,7 @@ describe('PubMatic adapter', function () {
h: 480,
battr: [13, 14],
linearity: 1,
placement: 2,
// plcmt: 2,
plcmt: 1,
minbitrate: 100,
maxbitrate: 4096
Expand Down Expand Up @@ -2564,7 +2564,6 @@ describe('PubMatic adapter', function () {
expect(data.imp[1]['video']['battr'][1]).to.equal(multipleMediaRequests[1].params.video['battr'][1]);

expect(data.imp[1]['video']['linearity']).to.equal(multipleMediaRequests[1].params.video['linearity']);
expect(data.imp[1]['video']['placement']).to.equal(multipleMediaRequests[1].params.video['placement']);
expect(data.imp[1]['video']['plcmt']).to.equal(multipleMediaRequests[1].params.video['plcmt']);
expect(data.imp[1]['video']['minbitrate']).to.equal(multipleMediaRequests[1].params.video['minbitrate']);
expect(data.imp[1]['video']['maxbitrate']).to.equal(multipleMediaRequests[1].params.video['maxbitrate']);
Expand Down Expand Up @@ -2860,7 +2859,6 @@ describe('PubMatic adapter', function () {
expect(data.imp[0]['video']['battr'][1]).to.equal(videoBidRequests[0].params.video['battr'][1]);

expect(data.imp[0]['video']['linearity']).to.equal(videoBidRequests[0].params.video['linearity']);
expect(data.imp[0]['video']['placement']).to.equal(videoBidRequests[0].params.video['placement']);
expect(data.imp[0]['video']['plcmt']).to.equal(videoBidRequests[0].params.video['plcmt']);
expect(data.imp[0]['video']['minbitrate']).to.equal(videoBidRequests[0].params.video['minbitrate']);
expect(data.imp[0]['video']['maxbitrate']).to.equal(videoBidRequests[0].params.video['maxbitrate']);
Expand Down Expand Up @@ -4044,10 +4042,10 @@ describe('PubMatic adapter', function () {
});

if (FEATURES.VIDEO) {
describe('Checking for Video.Placement property', function() {
describe('Checking for Video.plcmt property', function() {
let sandbox, utilsMock;
const adUnit = 'Div1';
const msg_placement_missing = 'Video.Placement param missing for Div1';
const msg_placement_missing = 'Video.plcmt param missing for Div1';
let videoData = {
battr: [6, 7],
skipafter: 15,
Expand Down Expand Up @@ -4076,7 +4074,7 @@ describe('PubMatic adapter', function () {
sinon.assert.calledWith(utils.logWarn, msg_placement_missing);
})
it('shoud not log Video.Placement param missing', function() {
videoData['placement'] = 1;
videoData['plcmt'] = 1;
checkVideoPlacement(videoData, adUnit);
sinon.assert.neverCalledWith(utils.logWarn, msg_placement_missing);
})
Expand Down

0 comments on commit 70b6e36

Please sign in to comment.