Skip to content

Commit

Permalink
oneVideo Bid Adapter: content object mapping bug fix (VDEFECT-5405) (p…
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-browning authored and stsepelin committed May 28, 2021
1 parent b18f926 commit 8c6521a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions modules/oneVideoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {registerBidder} from '../src/adapters/bidderFactory.js';
const BIDDER_CODE = 'oneVideo';
export const spec = {
code: 'oneVideo',
VERSION: '3.0.6',
VERSION: '3.0.7',
ENDPOINT: 'https://ads.adaptv.advertising.com/rtb/openrtb?ext_id=',
E2ETESTENDPOINT: 'https://ads-wc.v.ssp.yahoo.com/rtb/openrtb?ext_id=',
SYNC_ENDPOINT1: 'https://pixel.advertising.com/ups/57304/sync?gdpr=&gdpr_consent=&_origin=0&redir=true',
Expand Down Expand Up @@ -312,7 +312,7 @@ function getRequestData(bid, consentData, bidRequest) {
}
}
if (bid.params.video.content && utils.isPlainObject(bid.params.video.content)) {
bidData.imp[0].content = {};
bidData.site.content = {};
const contentStringKeys = ['id', 'title', 'series', 'season', 'genre', 'contentrating', 'language'];
const contentNumberkeys = ['episode', 'prodq', 'context', 'livestream', 'len'];
const contentArrayKeys = ['cat'];
Expand All @@ -324,7 +324,7 @@ function getRequestData(bid, consentData, bidRequest) {
(contentObjectKeys.indexOf(contentKey) > -1 && utils.isPlainObject(bid.params.video.content[contentKey])) ||
(contentArrayKeys.indexOf(contentKey) > -1 && utils.isArray(bid.params.video.content[contentKey]) &&
bid.params.video.content[contentKey].every(catStr => utils.isStr(catStr)))) {
bidData.imp[0].content[contentKey] = bid.params.video.content[contentKey];
bidData.site.content[contentKey] = bid.params.video.content[contentKey];
} else {
utils.logMessage('oneVideo bid adapter validation error: ', contentKey, ' is either not supported is OpenRTB V2.5 or value is undefined');
}
Expand Down
34 changes: 17 additions & 17 deletions test/spec/modules/oneVideoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ describe('OneVideoBidAdapter', function () {
const placement = bidRequest.params.video.placement;
const rewarded = bidRequest.params.video.rewarded;
const inventoryid = bidRequest.params.video.inventoryid;
const VERSION = '3.0.6';
const VERSION = '3.0.7';
expect(data.imp[0].video.w).to.equal(width);
expect(data.imp[0].video.h).to.equal(height);
expect(data.imp[0].bidfloor).to.equal(bidRequest.params.bidfloor);
Expand Down Expand Up @@ -387,37 +387,37 @@ describe('OneVideoBidAdapter', function () {
bidRequest.params.video.content = null;
const requests = spec.buildRequests([bidRequest], bidderRequest);
const data = requests[0].data;
expect(data.imp[0].content).to.be.undefined;
expect(data.site.content).to.be.undefined;
});
it('should not accept content object if value is is Array ', function () {
bidRequest.params.video.content = [];
const requests = spec.buildRequests([bidRequest], bidderRequest);
const data = requests[0].data;
expect(data.imp[0].content).to.be.undefined;
expect(data.site.content).to.be.undefined;
});
it('should not accept content object if value is Number ', function () {
bidRequest.params.video.content = 123456;
const requests = spec.buildRequests([bidRequest], bidderRequest);
const data = requests[0].data;
expect(data.imp[0].content).to.be.undefined;
expect(data.site.content).to.be.undefined;
});
it('should not accept content object if value is String ', function () {
bidRequest.params.video.content = 'keyValuePairs';
const requests = spec.buildRequests([bidRequest], bidderRequest);
const data = requests[0].data;
expect(data.imp[0].content).to.be.undefined;
expect(data.site.content).to.be.undefined;
});
it('should not accept content object if value is Boolean ', function () {
bidRequest.params.video.content = true;
const requests = spec.buildRequests([bidRequest], bidderRequest);
const data = requests[0].data;
expect(data.imp[0].content).to.be.undefined;
expect(data.site.content).to.be.undefined;
});
it('should accept content object if value is Object ', function () {
bidRequest.params.video.content = {};
const requests = spec.buildRequests([bidRequest], bidderRequest);
const data = requests[0].data;
expect(data.imp[0].content).to.be.a('object');
expect(data.site.content).to.be.a('object');
});

it('should not append unsupported content object keys', function () {
Expand All @@ -428,7 +428,7 @@ describe('OneVideoBidAdapter', function () {
};
const requests = spec.buildRequests([bidRequest], bidderRequest);
const data = requests[0].data;
expect(data.imp[0].content).to.be.empty;
expect(data.site.content).to.be.empty;
});

it('should not append content string parameters if value is not string ', function () {
Expand All @@ -443,8 +443,8 @@ describe('OneVideoBidAdapter', function () {
};
const requests = spec.buildRequests([bidRequest], bidderRequest);
const data = requests[0].data;
expect(data.imp[0].content).to.be.a('object');
expect(data.imp[0].content).to.be.empty
expect(data.site.content).to.be.a('object');
expect(data.site.content).to.be.empty
});
it('should not append content Number parameters if value is not Number ', function () {
bidRequest.params.video.content = {
Expand All @@ -456,26 +456,26 @@ describe('OneVideoBidAdapter', function () {
};
const requests = spec.buildRequests([bidRequest], bidderRequest);
const data = requests[0].data;
expect(data.imp[0].content).to.be.a('object');
expect(data.imp[0].content).to.be.empty
expect(data.site.content).to.be.a('object');
expect(data.site.content).to.be.empty
});
it('should not append content Array parameters if value is not Array ', function () {
bidRequest.params.video.content = {
cat: 'categories',
};
const requests = spec.buildRequests([bidRequest], bidderRequest);
const data = requests[0].data;
expect(data.imp[0].content).to.be.a('object');
expect(data.imp[0].content).to.be.empty
expect(data.site.content).to.be.a('object');
expect(data.site.content).to.be.empty
});
it('should not append content ext if value is not Object ', function () {
bidRequest.params.video.content = {
ext: 'content.ext',
};
const requests = spec.buildRequests([bidRequest], bidderRequest);
const data = requests[0].data;
expect(data.imp[0].content).to.be.a('object');
expect(data.imp[0].content).to.be.empty
expect(data.site.content).to.be.a('object');
expect(data.site.content).to.be.empty
});
it('should append supported parameters if value match validations ', function () {
bidRequest.params.video.content = {
Expand All @@ -498,7 +498,7 @@ describe('OneVideoBidAdapter', function () {
};
const requests = spec.buildRequests([bidRequest], bidderRequest);
const data = requests[0].data;
expect(data.imp[0].content).to.deep.equal(bidRequest.params.video.content);
expect(data.site.content).to.deep.equal(bidRequest.params.video.content);
});
});
});
Expand Down

0 comments on commit 8c6521a

Please sign in to comment.