',
+ 'crid': '540221061',
+ 'w': 970,
+ 'h': 250,
+ 'ext': {
+ 'prebid': {
+ 'type': 'banner'
+ },
+ 'bidder': {
+ 'ozone': {}
+ }
+ },
+ 'cpm': 0.01,
+ 'bidId': '3025f169863b7f8',
+ 'requestId': '3025f169863b7f8',
+ 'width': 970,
+ 'height': 250,
+ 'ad': '
',
+ 'netRevenue': true,
+ 'creativeId': '540221061',
+ 'currency': 'USD',
+ 'ttl': 300,
+ 'originalCpm': 0.01,
+ 'originalCurrency': 'USD'
}
],
'seat': 'openx'
}
],
'ext': {
+ 'debug': {},
'responsetimemillis': {
- 'appnexus': 91,
- 'openx': 109,
- 'ozappnexus': 46,
- 'ozbeeswax': 2,
- 'pangaea': 91
+ 'beeswax': 6,
+ 'openx': 91,
+ 'ozappnexus': 40,
+ 'ozbeeswax': 6
}
}
},
'headers': {}
};
+/*
+--------------------end of 2 slots, 2 ----------------------------
+ */
+
describe('ozone Adapter', function () {
describe('isBidRequestValid', function () {
// A test ad unit that will consistently return test creatives
@@ -473,7 +1589,7 @@ describe('ozone Adapter', function () {
publisherId: '9876abcd12-3',
siteId: '1234567890',
customData: [{'settings': {}, 'targeting': {'gender': 'bart', 'age': 'low'}}],
- lotameData: {'Profile': {'tpid': 'c8ef27a0d4ba771a81159f0d2e792db4', 'Audiences': {'Audience': [{'id': '99999', 'abbr': 'sports'}, {'id': '88888', 'abbr': 'movie'}, {'id': '77777', 'abbr': 'blogger'}], 'ThirdPartyAudience': [{'id': '123', 'name': 'Automobiles'}, {'id': '456', 'name': 'Ages: 30-39'}]}}},
+ lotameData: {'Profile': {'tpid': 'c8ef27a0d4ba771a81159f0d2e792db4', 'Audiences': {'Audience': [{'id': '99999', 'abbr': 'sports'}, {'id': '88888', 'abbr': 'movie'}, {'id': '77777', 'abbr': 'blogger'}]}}},
},
siteId: 1234567890
}
@@ -854,26 +1970,26 @@ describe('ozone Adapter', function () {
describe('buildRequests', function () {
it('sends bid request to OZONEURI via POST', function () {
- const request = spec.buildRequests(validBidRequests, validBidderRequest);
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
expect(request.url).to.equal(OZONEURI);
expect(request.method).to.equal('POST');
});
it('sends data as a string', function () {
- const request = spec.buildRequests(validBidRequests, validBidderRequest);
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
expect(request.data).to.be.a('string');
});
it('sends all bid parameters', function () {
- const request = spec.buildRequests(validBidRequests, validBidderRequest);
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
expect(request).to.have.all.keys(['bidderRequest', 'data', 'method', 'url']);
});
it('adds all parameters inside the ext object only', function () {
- const request = spec.buildRequests(validBidRequests, validBidderRequest);
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
expect(request.data).to.be.a('string');
var data = JSON.parse(request.data);
- expect(data.imp[0].ext.ozone.lotameData).to.be.an('object');
+ expect(data.ext.ozone.lotameData).to.be.an('object');
expect(data.imp[0].ext.ozone.customData).to.be.an('array');
expect(request).not.to.have.key('lotameData');
expect(request).not.to.have.key('customData');
@@ -882,10 +1998,10 @@ describe('ozone Adapter', function () {
it('ignores ozoneData in & after version 2.1.1', function () {
let validBidRequestsWithOzoneData = validBidRequests;
validBidRequestsWithOzoneData[0].params.ozoneData = {'networkID': '3048', 'dfpSiteID': 'd.thesun', 'sectionID': 'homepage', 'path': '/', 'sec_id': 'null', 'sec': 'sec', 'topics': 'null', 'kw': 'null', 'aid': 'null', 'search': 'null', 'article_type': 'null', 'hide_ads': '', 'article_slug': 'null'};
- const request = spec.buildRequests(validBidRequests, validBidderRequest);
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
expect(request.data).to.be.a('string');
var data = JSON.parse(request.data);
- expect(data.imp[0].ext.ozone.lotameData).to.be.an('object');
+ expect(data.ext.ozone.lotameData).to.be.an('object');
expect(data.imp[0].ext.ozone.customData).to.be.an('array');
expect(data.imp[0].ext.ozone.ozoneData).to.be.undefined;
expect(request).not.to.have.key('lotameData');
@@ -893,33 +2009,33 @@ describe('ozone Adapter', function () {
});
it('has correct bidder', function () {
- const request = spec.buildRequests(validBidRequests, validBidderRequest);
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
expect(request.bidderRequest.bids[0].bidder).to.equal(BIDDER_CODE);
});
it('handles mediaTypes element correctly', function () {
- const request = spec.buildRequests(validBidRequestsWithBannerMediaType, validBidderRequest);
+ const request = spec.buildRequests(validBidRequestsWithBannerMediaType, validBidderRequest.bidderRequest);
expect(request).to.have.all.keys(['bidderRequest', 'data', 'method', 'url']);
});
it('handles no ozone, lotame or custom data', function () {
- const request = spec.buildRequests(validBidRequestsMinimal, validBidderRequest);
+ const request = spec.buildRequests(validBidRequestsMinimal, validBidderRequest.bidderRequest);
expect(request).to.have.all.keys(['bidderRequest', 'data', 'method', 'url']);
});
it('handles video mediaType element correctly, with outstream video', function () {
- const request = spec.buildRequests(validBidRequestsWithNonBannerMediaTypesAndValidOutstreamVideo, validBidderRequest);
+ const request = spec.buildRequests(validBidRequests1OutstreamVideo2020, validBidderRequest.bidderRequest);
expect(request).to.have.all.keys(['bidderRequest', 'data', 'method', 'url']);
});
it('should not crash when there is no sizes element at all', function () {
- const request = spec.buildRequests(validBidRequestsNoSizes, validBidderRequest);
+ const request = spec.buildRequests(validBidRequestsNoSizes, validBidderRequest.bidderRequest);
expect(request).to.have.all.keys(['bidderRequest', 'data', 'method', 'url']);
});
it('should be able to handle non-single requests', function () {
config.setConfig({'ozone': {'singleRequest': false}});
- const request = spec.buildRequests(validBidRequestsNoSizes, validBidderRequest);
+ const request = spec.buildRequests(validBidRequestsNoSizes, validBidderRequest.bidderRequest);
expect(request).to.be.a('array');
expect(request[0]).to.have.all.keys(['bidderRequest', 'data', 'method', 'url']);
// need to reset the singleRequest config flag:
@@ -928,7 +2044,7 @@ describe('ozone Adapter', function () {
it('should add gdpr consent information to the request when ozone is true', function () {
let consentString = 'BOcocyaOcocyaAfEYDENCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NphLgA==';
- let bidderRequest = validBidderRequest;
+ let bidderRequest = validBidderRequest.bidderRequest;
bidderRequest.gdprConsent = {
consentString: consentString,
gdprApplies: true,
@@ -947,9 +2063,9 @@ describe('ozone Adapter', function () {
});
// mirror
- it('should add gdpr consent information to the request when ozone.oz_enforceGdpr is false and vendorData is missing vendorConsents (Mirror)', function () {
+ it('should add gdpr consent information to the request when vendorData is missing vendorConsents (Mirror)', function () {
let consentString = 'BOcocyaOcocyaAfEYDENCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NphLgA==';
- let bidderRequest = validBidderRequest;
+ let bidderRequest = validBidderRequest.bidderRequest;
bidderRequest.gdprConsent = {
consentString: consentString,
gdprApplies: true,
@@ -964,43 +2080,9 @@ describe('ozone Adapter', function () {
expect(payload.regs.ext.gdpr).to.equal(1);
expect(payload.user.ext.consent).to.equal(consentString);
});
- it('should add gdpr consent information to the request when ozone.oz_enforceGdpr is NOT PRESENT and vendorData is missing vendorConsents (Mirror)', function () {
- let consentString = 'BOcocyaOcocyaAfEYDENCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NphLgA==';
- let bidderRequest = validBidderRequest;
- bidderRequest.gdprConsent = {
- consentString: consentString,
- gdprApplies: true,
- vendorData: {
- metadata: consentString,
- gdprApplies: true
- }
- }
- const request = spec.buildRequests(validBidRequestsNoSizes, bidderRequest);
- const payload = JSON.parse(request.data);
- expect(payload.regs.ext.gdpr).to.equal(1);
- expect(payload.user.ext.consent).to.equal(consentString);
- config.resetConfig();
- });
- it('should kill the auction request when ozone.oz_enforceGdpr is true & vendorData is missing vendorConsents (Mirror)', function () {
- let consentString = 'BOcocyaOcocyaAfEYDENCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NphLgA==';
- let bidderRequest = validBidderRequest;
- bidderRequest.gdprConsent = {
- consentString: consentString,
- gdprApplies: true,
- vendorData: {
- metadata: consentString,
- gdprApplies: true
- }
- }
- config.setConfig({'ozone': {'oz_enforceGdpr': true}});
- const request = spec.buildRequests(validBidRequestsNoSizes, bidderRequest);
- expect(request.length).to.equal(0);
- config.resetConfig();
- });
-
it('should set regs.ext.gdpr flag to 0 when gdprApplies is false', function () {
let consentString = 'BOcocyaOcocyaAfEYDENCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NphLgA==';
- let bidderRequest = validBidderRequest;
+ let bidderRequest = validBidderRequest.bidderRequest;
bidderRequest.gdprConsent = {
consentString: consentString,
gdprApplies: false,
@@ -1019,7 +2101,7 @@ describe('ozone Adapter', function () {
it('should not have imp[N].ext.ozone.userId', function () {
let consentString = 'BOcocyaOcocyaAfEYDENCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NphLgA==';
- let bidderRequest = validBidderRequest;
+ let bidderRequest = validBidderRequest.bidderRequest;
bidderRequest.gdprConsent = {
consentString: consentString,
gdprApplies: false,
@@ -1063,14 +2145,14 @@ describe('ozone Adapter', function () {
// 'pubcid': '5555', // remove pubcid from here to emulate the OLD module & cause the failover code to kick in
'tdid': '6666'
};
- const request = spec.buildRequests(bidRequests, validBidderRequest);
+ const request = spec.buildRequests(bidRequests, validBidderRequest.bidderRequest);
const payload = JSON.parse(request.data);
expect(payload.ext.ozone.pubcid).to.equal(bidRequests[0]['crumbs']['pubcid']);
delete validBidRequests[0].userId; // tidy up now, else it will screw with other tests
});
it('should add a user.ext.eids object to contain user ID data in the new location (Nov 2019)', function() {
- const request = spec.buildRequests(validBidRequestsWithUserIdData, validBidderRequest);
+ const request = spec.buildRequests(validBidRequestsWithUserIdData, validBidderRequest.bidderRequest);
const payload = JSON.parse(request.data);
expect(payload.user).to.exist;
expect(payload.user.ext).to.exist;
@@ -1096,7 +2178,7 @@ describe('ozone Adapter', function () {
spec.getGetParametersAsObject = function() {
return {'oztestmode': 'mytestvalue_123'};
};
- const request = spec.buildRequests(validBidRequests, validBidderRequest);
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
const data = JSON.parse(request.data);
expect(data.imp[0].ext.ozone.customData).to.be.an('array');
expect(data.imp[0].ext.ozone.customData[0].targeting.oztestmode).to.equal('mytestvalue_123');
@@ -1106,7 +2188,7 @@ describe('ozone Adapter', function () {
spec.getGetParametersAsObject = function() {
return {'oztestmode': 'mytestvalue_123'};
};
- const request = spec.buildRequests(validBidRequestsMinimal, validBidderRequest);
+ const request = spec.buildRequests(validBidRequestsMinimal, validBidderRequest.bidderRequest);
const data = JSON.parse(request.data);
expect(data.imp[0].ext.ozone.customData).to.be.an('array');
expect(data.imp[0].ext.ozone.customData[0].targeting.oztestmode).to.equal('mytestvalue_123');
@@ -1117,7 +2199,7 @@ describe('ozone Adapter', function () {
specMock.getGetParametersAsObject = function() {
return {'ozstoredrequest': '1122334455'}; // 10 digits are valid
};
- const request = specMock.buildRequests(validBidRequestsMinimal, validBidderRequest);
+ const request = specMock.buildRequests(validBidRequestsMinimal, validBidderRequest.bidderRequest);
const data = JSON.parse(request.data);
expect(data.ext.ozone.oz_rw).to.equal(1);
expect(data.imp[0].ext.prebid.storedrequest.id).to.equal('1122334455');
@@ -1127,7 +2209,7 @@ describe('ozone Adapter', function () {
specMock.getGetParametersAsObject = function() {
return {'ozstoredrequest': 'BADVAL'}; // 10 digits are valid
};
- const request = specMock.buildRequests(validBidRequestsMinimal, validBidderRequest);
+ const request = specMock.buildRequests(validBidRequestsMinimal, validBidderRequest.bidderRequest);
const data = JSON.parse(request.data);
expect(data.ext.ozone.oz_rw).to.equal(0);
expect(data.imp[0].ext.prebid.storedrequest.id).to.equal('1310000099');
@@ -1137,9 +2219,9 @@ describe('ozone Adapter', function () {
spec.getGetParametersAsObject = function() {
return {'oz_lotameid': '123abc', 'oz_lotamepid': 'pid123', 'oz_lotametpid': '123eee'};
};
- const request = spec.buildRequests(validBidRequests, validBidderRequest);
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
const payload = JSON.parse(request.data);
- expect(payload.imp[0].ext.ozone.lotameData.Profile.Audiences.Audience[0].id).to.equal('123abc');
+ expect(payload.ext.ozone.lotameData.Profile.Audiences.Audience[0].id).to.equal('123abc');
expect(payload.ext.ozone.oz_lot_rw).to.equal(1);
});
it('should pick up the value of valid lotame override parameters when there is an empty lotame object', function () {
@@ -1148,11 +2230,11 @@ describe('ozone Adapter', function () {
spec.getGetParametersAsObject = function() {
return {'oz_lotameid': '123abc', 'oz_lotamepid': 'pid123', 'oz_lotametpid': '123eeetpid'};
};
- const request = spec.buildRequests(nolotameBidReq, validBidderRequest);
+ const request = spec.buildRequests(nolotameBidReq, validBidderRequest.bidderRequest);
const payload = JSON.parse(request.data);
- expect(payload.imp[0].ext.ozone.lotameData.Profile.Audiences.Audience[0].id).to.equal('123abc');
- expect(payload.imp[0].ext.ozone.lotameData.Profile.tpid).to.equal('123eeetpid');
- expect(payload.imp[0].ext.ozone.lotameData.Profile.pid).to.equal('pid123');
+ expect(payload.ext.ozone.lotameData.Profile.Audiences.Audience[0].id).to.equal('123abc');
+ expect(payload.ext.ozone.lotameData.Profile.tpid).to.equal('123eeetpid');
+ expect(payload.ext.ozone.lotameData.Profile.pid).to.equal('pid123');
expect(payload.ext.ozone.oz_lot_rw).to.equal(1);
});
it('should pick up the value of valid lotame override parameters when there is NO "lotame" key at all', function () {
@@ -1161,27 +2243,29 @@ describe('ozone Adapter', function () {
spec.getGetParametersAsObject = function() {
return {'oz_lotameid': '123abc', 'oz_lotamepid': 'pid123', 'oz_lotametpid': '123eeetpid'};
};
- const request = spec.buildRequests(nolotameBidReq, validBidderRequest);
+ const request = spec.buildRequests(nolotameBidReq, validBidderRequest.bidderRequest);
const payload = JSON.parse(request.data);
- expect(payload.imp[0].ext.ozone.lotameData.Profile.Audiences.Audience[0].id).to.equal('123abc');
- expect(payload.imp[0].ext.ozone.lotameData.Profile.tpid).to.equal('123eeetpid');
- expect(payload.imp[0].ext.ozone.lotameData.Profile.pid).to.equal('pid123');
+ expect(payload.ext.ozone.lotameData.Profile.Audiences.Audience[0].id).to.equal('123abc');
+ expect(payload.ext.ozone.lotameData.Profile.tpid).to.equal('123eeetpid');
+ expect(payload.ext.ozone.lotameData.Profile.pid).to.equal('pid123');
expect(payload.ext.ozone.oz_lot_rw).to.equal(1);
+ spec.propertyBag = originalPropertyBag; // tidy up
});
// NOTE - only one negative test case;
// you can't send invalid lotame params to buildRequests because 'validate' will have rejected them
it('should not use lotame override parameters if they dont exist', function () {
+ expect(spec.propertyBag.lotameWasOverridden).to.equal(0);
spec.getGetParametersAsObject = function() {
return {}; // no lotame override params
};
- const request = spec.buildRequests(validBidRequests, validBidderRequest);
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
const payload = JSON.parse(request.data);
expect(payload.ext.ozone.oz_lot_rw).to.equal(0);
});
it('should pick up the config value of coppa & set it in the request', function () {
config.setConfig({'coppa': true});
- const request = spec.buildRequests(validBidRequestsNoSizes, validBidderRequest);
+ const request = spec.buildRequests(validBidRequestsNoSizes, validBidderRequest.bidderRequest);
const payload = JSON.parse(request.data);
expect(payload.regs).to.include.keys('coppa');
expect(payload.regs.coppa).to.equal(1);
@@ -1189,22 +2273,75 @@ describe('ozone Adapter', function () {
});
it('should pick up the config value of coppa & only set it in the request if its true', function () {
config.setConfig({'coppa': false});
- const request = spec.buildRequests(validBidRequestsNoSizes, validBidderRequest);
+ const request = spec.buildRequests(validBidRequestsNoSizes, validBidderRequest.bidderRequest);
const payload = JSON.parse(request.data);
expect(utils.deepAccess(payload, 'regs.coppa')).to.be.undefined;
config.resetConfig();
});
+ it('should handle oz_omp_floor correctly', function () {
+ config.setConfig({'ozone': {'oz_omp_floor': 1.56}});
+ const request = spec.buildRequests(validBidRequestsNoSizes, validBidderRequest.bidderRequest);
+ const payload = JSON.parse(request.data);
+ expect(utils.deepAccess(payload, 'ext.ozone.oz_omp_floor')).to.equal(1.56);
+ config.resetConfig();
+ });
+ it('should ignore invalid oz_omp_floor values', function () {
+ config.setConfig({'ozone': {'oz_omp_floor': '1.56'}});
+ const request = spec.buildRequests(validBidRequestsNoSizes, validBidderRequest.bidderRequest);
+ const payload = JSON.parse(request.data);
+ expect(utils.deepAccess(payload, 'ext.ozone.oz_omp_floor')).to.be.undefined;
+ config.resetConfig();
+ });
+ it('should should contain a unique page view id in the auction request which persists across calls', function () {
+ let request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
+ let payload = JSON.parse(request.data);
+ expect(utils.deepAccess(payload, 'ext.ozone.pv')).to.be.a('string');
+ request = spec.buildRequests(validBidRequests1OutstreamVideo2020, validBidderRequest.bidderRequest);
+ let payload2 = JSON.parse(request.data);
+ expect(utils.deepAccess(payload2, 'ext.ozone.pv')).to.be.a('string');
+ expect(utils.deepAccess(payload2, 'ext.ozone.pv')).to.equal(utils.deepAccess(payload, 'ext.ozone.pv'));
+ });
+ it('should indicate that the whitelist was used when it contains valid data', function () {
+ config.setConfig({'ozone': {'oz_whitelist_adserver_keys': ['oz_ozappnexus_pb', 'oz_ozappnexus_imp_id']}});
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
+ const payload = JSON.parse(request.data);
+ expect(payload.ext.ozone.oz_kvp_rw).to.equal(1);
+ config.resetConfig();
+ });
+ it('should indicate that the whitelist was not used when it contains no data', function () {
+ config.setConfig({'ozone': {'oz_whitelist_adserver_keys': []}});
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
+ const payload = JSON.parse(request.data);
+ expect(payload.ext.ozone.oz_kvp_rw).to.equal(0);
+ config.resetConfig();
+ });
+ it('should indicate that the whitelist was not used when it is not set in the config', function () {
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
+ const payload = JSON.parse(request.data);
+ expect(payload.ext.ozone.oz_kvp_rw).to.equal(0);
+ });
+ it('should have openrtb video params', function() {
+ let allowed = ['mimes', 'minduration', 'maxduration', 'protocols', 'w', 'h', 'startdelay', 'placement', 'linearity', 'skip', 'skipmin', 'skipafter', 'sequence', 'battr', 'maxextended', 'minbitrate', 'maxbitrate', 'boxingallowed', 'playbackmethod', 'playbackend', 'delivery', 'pos', 'companionad', 'api', 'companiontype', 'ext'];
+ const request = spec.buildRequests(validBidRequests1OutstreamVideo2020, validBidderRequest.bidderRequest);
+ const payload = JSON.parse(request.data);
+ const vid = (payload.imp[0].video);
+ const keys = Object.keys(vid);
+ for (let i = 0; i < keys.length; i++) {
+ expect(allowed).to.include(keys[i]);
+ }
+ expect(payload.imp[0].video.ext).to.include({'context': 'outstream'});
+ });
});
describe('interpretResponse', function () {
it('should build bid array', function () {
- const request = spec.buildRequests(validBidRequests, validBidderRequest);
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
const result = spec.interpretResponse(validResponse, request);
expect(result.length).to.equal(1);
});
it('should have all relevant fields', function () {
- const request = spec.buildRequests(validBidRequests, validBidderRequest);
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
const result = spec.interpretResponse(validResponse, request);
const bid = result[0];
expect(bid.cpm).to.equal(validResponse.body.seatbid[0].bid[0].cpm);
@@ -1213,16 +2350,15 @@ describe('ozone Adapter', function () {
});
it('should build bid array with gdpr', function () {
- let validBR = JSON.parse(JSON.stringify(bidderRequestWithFullGdpr));
+ let validBR = JSON.parse(JSON.stringify(bidderRequestWithFullGdpr.bidderRequest));
validBR.gdprConsent = {'gdprApplies': 1, 'consentString': 'This is the gdpr consent string'};
const request = spec.buildRequests(validBidRequests, validBR); // works the old way, with GDPR not enforced by default
- // const request = spec.buildRequests(validBidRequests, bidderRequestWithFullGdpr); // works with oz_enforceGdpr true by default
const result = spec.interpretResponse(validResponse, request);
expect(result.length).to.equal(1);
});
it('should build bid array with only partial gdpr', function () {
- var validBidderRequestWithGdpr = bidderRequestWithPartialGdpr;
+ var validBidderRequestWithGdpr = bidderRequestWithPartialGdpr.bidderRequest;
validBidderRequestWithGdpr.gdprConsent = {'gdprApplies': 1, 'consentString': 'This is the gdpr consent string'};
const request = spec.buildRequests(validBidRequests, validBidderRequestWithGdpr);
});
@@ -1239,24 +2375,164 @@ describe('ozone Adapter', function () {
expect(result).to.be.empty;
});
- it('should have video renderer', function () {
- const request = spec.buildRequests(validBidRequestsWithNonBannerMediaTypesAndValidOutstreamVideo, validBidderRequest);
- const result = spec.interpretResponse(validOutstreamResponse, request);
+ it('should have video renderer for outstream video', function () {
+ const request = spec.buildRequests(validBidRequests1OutstreamVideo2020, validBidderRequest1OutstreamVideo2020.bidderRequest);
+ const result = spec.interpretResponse(getCleanValidVideoResponse(), validBidderRequest1OutstreamVideo2020);
const bid = result[0];
expect(bid.renderer).to.be.an.instanceOf(Renderer);
});
+ it('should have NO video renderer for instream video', function () {
+ let instreamRequestsObj = JSON.parse(JSON.stringify(validBidRequests1OutstreamVideo2020));
+ instreamRequestsObj[0].mediaTypes.video.context = 'instream';
+ let instreamBidderReq = JSON.parse(JSON.stringify(validBidderRequest1OutstreamVideo2020));
+ instreamBidderReq.bidderRequest.bids[0].mediaTypes.video.context = 'instream';
+ const request = spec.buildRequests(instreamRequestsObj, validBidderRequest1OutstreamVideo2020.bidderRequest);
+ const result = spec.interpretResponse(getCleanValidVideoResponse(), instreamBidderReq);
+ const bid = result[0];
+ expect(bid.hasOwnProperty('renderer')).to.be.false;
+ });
+
it('should correctly parse response where there are more bidders than ad slots', function () {
- const request = spec.buildRequests(validBidRequests, validBidderRequest);
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
const result = spec.interpretResponse(validBidResponse1adWith2Bidders, request);
expect(result.length).to.equal(2);
});
it('should have a ttl of 600', function () {
- const request = spec.buildRequests(validBidRequests, validBidderRequest);
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
const result = spec.interpretResponse(validResponse, request);
expect(result[0].ttl).to.equal(300);
});
+
+ it('should handle oz_omp_floor_dollars correctly, inserting 1 as necessary', function () {
+ config.setConfig({'ozone': {'oz_omp_floor': 0.01}});
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
+ const result = spec.interpretResponse(validResponse, request);
+ expect(utils.deepAccess(result[0].adserverTargeting, 'oz_appnexus_omp')).to.equal('1');
+ config.resetConfig();
+ });
+ it('should handle oz_omp_floor_dollars correctly, inserting 0 as necessary', function () {
+ config.setConfig({'ozone': {'oz_omp_floor': 2.50}});
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
+ const result = spec.interpretResponse(validResponse, request);
+ expect(utils.deepAccess(result[0].adserverTargeting, 'oz_appnexus_omp')).to.equal('0');
+ config.resetConfig();
+ });
+ it('should handle missing oz_omp_floor_dollars correctly, inserting nothing', function () {
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
+ const result = spec.interpretResponse(validResponse, request);
+ expect(utils.deepAccess(result[0].adserverTargeting, 'oz_appnexus_omp')).to.be.undefined;
+ });
+ it('should handle ext.bidder.ozone.floor correctly, setting flr & rid as necessary', function () {
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
+ let vres = JSON.parse(JSON.stringify(validResponse));
+ vres.body.seatbid[0].bid[0].ext.bidder.ozone = {floor: 1, ruleId: 'ZjbsYE1q'};
+ const result = spec.interpretResponse(vres, request);
+ expect(utils.deepAccess(result[0].adserverTargeting, 'oz_appnexus_flr')).to.equal(1);
+ expect(utils.deepAccess(result[0].adserverTargeting, 'oz_appnexus_rid')).to.equal('ZjbsYE1q');
+ config.resetConfig();
+ });
+ it('should handle ext.bidder.ozone.floor correctly, inserting 0 as necessary', function () {
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
+ let vres = JSON.parse(JSON.stringify(validResponse));
+ vres.body.seatbid[0].bid[0].ext.bidder.ozone = {floor: 0, ruleId: 'ZjbXXE1q'};
+ const result = spec.interpretResponse(vres, request);
+ expect(utils.deepAccess(result[0].adserverTargeting, 'oz_appnexus_flr')).to.equal(0);
+ expect(utils.deepAccess(result[0].adserverTargeting, 'oz_appnexus_rid')).to.equal('ZjbXXE1q');
+ config.resetConfig();
+ });
+ it('should handle ext.bidder.ozone.floor correctly, inserting nothing as necessary', function () {
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
+ let vres = JSON.parse(JSON.stringify(validResponse));
+ vres.body.seatbid[0].bid[0].ext.bidder.ozone = {};
+ const result = spec.interpretResponse(vres, request);
+ expect(utils.deepAccess(result[0].adserverTargeting, 'oz_appnexus_flr', null)).to.equal(null);
+ expect(utils.deepAccess(result[0].adserverTargeting, 'oz_appnexus_rid', null)).to.equal(null);
+ config.resetConfig();
+ });
+ it('should handle ext.bidder.ozone.floor correctly, when bidder.ozone is not there', function () {
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
+ let vres = JSON.parse(JSON.stringify(validResponse));
+ const result = spec.interpretResponse(vres, request);
+ expect(utils.deepAccess(result[0].adserverTargeting, 'oz_appnexus_flr', null)).to.equal(null);
+ expect(utils.deepAccess(result[0].adserverTargeting, 'oz_appnexus_rid', null)).to.equal(null);
+ config.resetConfig();
+ });
+ it('should handle a valid whitelist, removing items not on the list & leaving others', function () {
+ config.setConfig({'ozone': {'oz_whitelist_adserver_keys': ['oz_appnexus_crid', 'oz_appnexus_adId']}});
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
+ const result = spec.interpretResponse(validResponse, request);
+ expect(utils.deepAccess(result[0].adserverTargeting, 'oz_appnexus_adv')).to.be.undefined;
+ expect(utils.deepAccess(result[0].adserverTargeting, 'oz_appnexus_adId')).to.equal('2899ec066a91ff8-0-0');
+ config.resetConfig();
+ });
+ it('should ignore a whitelist if enhancedAdserverTargeting is false', function () {
+ config.setConfig({'ozone': {'oz_whitelist_adserver_keys': ['oz_appnexus_crid', 'oz_appnexus_imp_id'], 'enhancedAdserverTargeting': false}});
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
+ const result = spec.interpretResponse(validResponse, request);
+ expect(utils.deepAccess(result[0].adserverTargeting, 'oz_appnexus_adv')).to.be.undefined;
+ expect(utils.deepAccess(result[0].adserverTargeting, 'oz_appnexus_imp_id')).to.be.undefined;
+ config.resetConfig();
+ });
+ it('should correctly handle enhancedAdserverTargeting being false', function () {
+ config.setConfig({'ozone': {'enhancedAdserverTargeting': false}});
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
+ const result = spec.interpretResponse(validResponse, request);
+ expect(utils.deepAccess(result[0].adserverTargeting, 'oz_appnexus_adv')).to.be.undefined;
+ expect(utils.deepAccess(result[0].adserverTargeting, 'oz_appnexus_imp_id')).to.be.undefined;
+ config.resetConfig();
+ });
+ it('should add flr into ads request if floor exists in the auction response', function () {
+ const request = spec.buildRequests(validBidRequestsMulti, validBidderRequest.bidderRequest);
+ let validres = JSON.parse(JSON.stringify(validResponse2Bids));
+ validres.body.seatbid[0].bid[0].ext.bidder.ozone = {'floor': 1};
+ const result = spec.interpretResponse(validres, request);
+ expect(utils.deepAccess(result[0].adserverTargeting, 'oz_appnexus_flr')).to.equal(1);
+ expect(utils.deepAccess(result[1].adserverTargeting, 'oz_appnexus_flr', '')).to.equal('');
+ });
+ it('should add rid into ads request if ruleId exists in the auction response', function () {
+ const request = spec.buildRequests(validBidRequestsMulti, validBidderRequest.bidderRequest);
+ let validres = JSON.parse(JSON.stringify(validResponse2Bids));
+ validres.body.seatbid[0].bid[0].ext.bidder.ozone = {'ruleId': 123};
+ const result = spec.interpretResponse(validres, request);
+ expect(utils.deepAccess(result[0].adserverTargeting, 'oz_appnexus_rid')).to.equal(123);
+ expect(utils.deepAccess(result[1].adserverTargeting, 'oz_appnexus_rid', '')).to.equal('');
+ });
+ it('should add oz_ozappnexus_sid (cid value) for all appnexus bids', function () {
+ const request = spec.buildRequests(validBidRequestsMulti, validBidderRequest.bidderRequest);
+ let validres = JSON.parse(JSON.stringify(validResponse2BidsSameAdunit));
+ const result = spec.interpretResponse(validres, request);
+ expect(utils.deepAccess(result[0].adserverTargeting, 'oz_ozappnexus_sid')).to.equal(result[0].cid);
+ });
+ it('should add unique adId values to each bid', function() {
+ const request = spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
+ let validres = JSON.parse(JSON.stringify(validResponse2BidsSameAdunit));
+ const result = spec.interpretResponse(validres, request);
+ expect(result.length).to.equal(1);
+ expect(result[0]['price']).to.equal(0.9);
+ expect(result[0]['adserverTargeting']['oz_ozappnexus_adId']).to.equal('2899ec066a91ff8-0-1');
+ });
+ it('should correctly process an auction with 2 adunits & multiple bidders one of which bids for both adslots', function() {
+ let validres = JSON.parse(JSON.stringify(multiResponse1));
+ let request = spec.buildRequests(multiRequest1, multiBidderRequest1.bidderRequest);
+ let result = spec.interpretResponse(validres, request);
+ expect(result.length).to.equal(4); // one of the 5 bids will have been removed
+ expect(result[1]['price']).to.equal(0.521);
+ expect(result[1]['impid']).to.equal('3025f169863b7f8');
+ expect(result[1]['id']).to.equal('18552976939844999');
+ expect(result[1]['adserverTargeting']['oz_ozappnexus_adId']).to.equal('3025f169863b7f8-0-2');
+ // change the bid values so a different second bid for an impid by the same bidder gets dropped
+ validres = JSON.parse(JSON.stringify(multiResponse1));
+ validres.body.seatbid[0].bid[1].price = 1.1;
+ validres.body.seatbid[0].bid[1].cpm = 1.1;
+ request = spec.buildRequests(multiRequest1, multiBidderRequest1.bidderRequest);
+ result = spec.interpretResponse(validres, request);
+ expect(result[1]['price']).to.equal(1.1);
+ expect(result[1]['impid']).to.equal('3025f169863b7f8');
+ expect(result[1]['id']).to.equal('18552976939844681');
+ expect(result[1]['adserverTargeting']['oz_ozappnexus_adId']).to.equal('3025f169863b7f8-0-1');
+ });
});
describe('userSyncs', function () {
@@ -1270,7 +2546,7 @@ describe('ozone Adapter', function () {
});
it('should append the various values if they exist', function() {
// get the cookie bag populated
- spec.buildRequests(validBidRequests, validBidderRequest);
+ spec.buildRequests(validBidRequests, validBidderRequest.bidderRequest);
const result = spec.getUserSyncs({iframeEnabled: true}, 'good server response', gdpr1);
expect(result).to.be.an('array');
expect(result[0].url).to.include('publisherId=9876abcd12-3');
@@ -1383,83 +2659,7 @@ describe('ozone Adapter', function () {
expect(result).to.be.false;
config.resetConfig();
});
- it('should return true if oz_enforceGdpr is true and consentString is undefined', function() {
- config.setConfig({'ozone': {'oz_enforceGdpr': true}});
- let req = JSON.parse(JSON.stringify(bidderRequestWithFullGdpr));
- delete req.gdprConsent.consentString;
- let result = spec.blockTheRequest(req);
- expect(result).to.be.true;
- config.resetConfig();
- });
- it('should return false if oz_enforceGdpr is false and consentString is undefined', function() {
- config.setConfig({'ozone': {'oz_enforceGdpr': false}});
- let req = JSON.parse(JSON.stringify(bidderRequestWithFullGdpr));
- delete req.gdprConsent.consentString;
- let result = spec.blockTheRequest(req);
- expect(result).to.be.false;
- config.resetConfig();
- });
- it('should return false if oz_enforceGdpr is NOT SET (default) and consentString is undefined', function() {
- let req = JSON.parse(JSON.stringify(bidderRequestWithFullGdpr));
- delete req.gdprConsent.consentString;
- let result = spec.blockTheRequest(req);
- expect(result).to.be.false;
- });
- it('should return false if gdprApplies is false', function() {
- config.setConfig({'ozone': {'oz_request': true}});
- let req = {'gdprConsent': {'gdprApplies': false}};
- let result = spec.blockTheRequest(req);
- expect(result).to.be.false;
- config.resetConfig();
- });
- it('should return false if gdprConsent key does not exist', function() {
- let req = JSON.parse(JSON.stringify(bidderRequestWithFullGdpr));
- config.setConfig({'ozone': {'oz_enforceGdpr': true}});
- delete req.gdprConsent;
- let result = spec.blockTheRequest(req);
- expect(result).to.be.false;
- config.resetConfig();
- });
- it('should return false if gdpr is set, and all is ok', function() {
- let req = JSON.parse(JSON.stringify(bidderRequestWithFullGdpr));
- config.setConfig({'ozone': {'oz_enforceGdpr': true}});
- let result = spec.blockTheRequest(req);
- expect(result).to.be.false;
- config.resetConfig();
- });
- });
-
- describe('failsGdprCheck', function() {
- it('should return false for a a fully accepted user', function () {
- let result = spec.failsGdprCheck(bidderRequestWithFullGdpr);
- expect(result).to.be.false;
- });
- it('should return false if gdprConsent is not present on the bidder object', function () {
- let result = spec.failsGdprCheck(validBidderRequest);
- expect(result).to.be.false;
- });
- it('should return true if gdpr applies and vendorData is not an array', function () {
- let req = JSON.parse(JSON.stringify(bidderRequestWithFullGdpr));
- req.gdprConsent.vendorData = null;
- let result = spec.failsGdprCheck(req);
- expect(result).to.be.true;
- });
- it('should return true if gdpr applies and purposeConsents do not contain all the required true values', function () {
- let req = JSON.parse(JSON.stringify(bidderRequestWithFullGdpr));
- req.gdprConsent.vendorData.purposeConsents[1] = false;
- let result = spec.failsGdprCheck(req);
- expect(result).to.be.true;
- });
- it('should return true if gdpr applies and vendorConsents[524] is not true', function () {
- config.setConfig({'ozone': {'oz_enforceGdpr': true}});
- let req = JSON.parse(JSON.stringify(bidderRequestWithFullGdpr));
- req.gdprConsent.vendorData.vendorConsents[524] = false;
- let result = spec.failsGdprCheck(req);
- expect(result).to.be.true;
- config.resetConfig();
- });
});
-
describe('makeLotameObjectFromOverride', function() {
it('should update an object with valid lotame data', function () {
let objLotameOverride = {'oz_lotametpid': '1234', 'oz_lotameid': '12345', 'oz_lotamepid': '123456'};
@@ -1498,4 +2698,125 @@ describe('ozone Adapter', function () {
expect(result).to.be.false;
});
});
+ describe('getPageId', function() {
+ it('should return the same Page ID for multiple calls', function () {
+ let result = spec.getPageId();
+ expect(result).to.be.a('string');
+ let result2 = spec.getPageId();
+ expect(result2).to.equal(result);
+ });
+ });
+ describe('getBidRequestForBidId', function() {
+ it('should locate a bid inside a bid array', function () {
+ let result = spec.getBidRequestForBidId('2899ec066a91ff8', validBidRequestsMulti);
+ expect(result.testId).to.equal(1);
+ result = spec.getBidRequestForBidId('2899ec066a91ff0', validBidRequestsMulti);
+ expect(result.testId).to.equal(2);
+ });
+ });
+ describe('getVideoContextForBidId', function() {
+ it('should locate the video context inside a bid', function () {
+ let result = spec.getVideoContextForBidId('2899ec066a91ff8', validBidRequestsWithNonBannerMediaTypesAndValidOutstreamVideo);
+ expect(result).to.equal('outstream');
+ });
+ });
+ describe('getLotameOverrideParams', function() {
+ it('should get 3 valid lotame params that exist in GET params', function () {
+ // mock the getGetParametersAsObject function to simulate GET parameters for lotame overrides:
+ spec.getGetParametersAsObject = function() {
+ return {'oz_lotameid': '123abc', 'oz_lotamepid': 'pid123', 'oz_lotametpid': 'tpid123'};
+ };
+ let result = spec.getLotameOverrideParams();
+ expect(Object.keys(result).length).to.equal(3);
+ });
+ it('should get only 1 valid lotame param that exists in GET params', function () {
+ // mock the getGetParametersAsObject function to simulate GET parameters for lotame overrides:
+ spec.getGetParametersAsObject = function() {
+ return {'oz_lotameid': '123abc', 'xoz_lotamepid': 'pid123', 'xoz_lotametpid': 'tpid123'};
+ };
+ let result = spec.getLotameOverrideParams();
+ expect(Object.keys(result).length).to.equal(1);
+ });
+ });
+ describe('unpackVideoConfigIntoIABformat', function() {
+ it('should correctly unpack a usual video config', function () {
+ let mediaTypes = {
+ playerSize: [640, 480],
+ mimes: ['video/mp4'],
+ context: 'outstream',
+ testKey: 'parent value'
+ };
+ let bid_params_video = {
+ skippable: true,
+ playback_method: ['auto_play_sound_off'],
+ playbackmethod: 2, /* start on load, no sound */
+ minduration: 5,
+ maxduration: 60,
+ skipmin: 5,
+ skipafter: 5,
+ testKey: 'child value'
+ };
+ let result = spec.unpackVideoConfigIntoIABformat(mediaTypes, bid_params_video);
+ expect(result.mimes).to.be.an('array').that.includes('video/mp4');
+ expect(result.ext.context).to.equal('outstream');
+ expect(result.ext.skippable).to.be.true; // note - we add skip in a different step: addVideoDefaults
+ expect(result.ext.testKey).to.equal('child value');
+ });
+ });
+ describe('addVideoDefaults', function() {
+ it('should correctly add video defaults', function () {
+ let mediaTypes = {
+ playerSize: [640, 480],
+ mimes: ['video/mp4'],
+ context: 'outstream',
+ };
+ let bid_params_video = {
+ skippable: true,
+ playback_method: ['auto_play_sound_off'],
+ playbackmethod: 2, /* start on load, no sound */
+ minduration: 5,
+ maxduration: 60,
+ skipmin: 5,
+ skipafter: 5,
+ testKey: 'child value'
+ };
+ let result = spec.addVideoDefaults({}, mediaTypes, mediaTypes);
+ expect(result.placement).to.equal(3);
+ expect(result.skip).to.equal(0);
+ result = spec.addVideoDefaults({}, mediaTypes, bid_params_video);
+ expect(result.skip).to.equal(1);
+ });
+ it('should correctly add video defaults including skippable in parent', function () {
+ let mediaTypes = {
+ playerSize: [640, 480],
+ mimes: ['video/mp4'],
+ context: 'outstream',
+ skippable: true
+ };
+ let bid_params_video = {
+ playback_method: ['auto_play_sound_off'],
+ playbackmethod: 2, /* start on load, no sound */
+ minduration: 5,
+ maxduration: 60,
+ skipmin: 5,
+ skipafter: 5,
+ testKey: 'child value'
+ };
+ let result = spec.addVideoDefaults({}, mediaTypes, bid_params_video);
+ expect(result.placement).to.equal(3);
+ expect(result.skip).to.equal(1);
+ });
+ });
+ describe('removeSingleBidderMultipleBids', function() {
+ it('should remove the multi bid by ozappnexus for adslot 2d30e86db743a8', function() {
+ let validres = JSON.parse(JSON.stringify(multiResponse1));
+ expect(validres.body.seatbid[0].bid.length).to.equal(3);
+ expect(validres.body.seatbid[0].seat).to.equal('ozappnexus');
+ let response = spec.removeSingleBidderMultipleBids(validres.body.seatbid);
+ expect(response.length).to.equal(2);
+ expect(response[0].bid.length).to.equal(2);
+ expect(response[0].seat).to.equal('ozappnexus');
+ expect(response[1].bid.length).to.equal(2);
+ });
+ });
});
diff --git a/test/spec/modules/padsquadBidAdapter_spec.js b/test/spec/modules/padsquadBidAdapter_spec.js
index d30b1f34a9e..7d0858ed25e 100644
--- a/test/spec/modules/padsquadBidAdapter_spec.js
+++ b/test/spec/modules/padsquadBidAdapter_spec.js
@@ -212,6 +212,7 @@ describe('Padsquad bid adapter', function () {
expect(bids[index]).to.have.property('height', RESPONSE.body.seatbid[0].bid[index].h);
expect(bids[index]).to.have.property('ad', RESPONSE.body.seatbid[0].bid[index].adm);
expect(bids[index]).to.have.property('creativeId', RESPONSE.body.seatbid[0].bid[index].crid);
+ expect(bids[index].meta.advertiserDomains).to.deep.equal(RESPONSE.body.seatbid[0].bid[index].adomain);
expect(bids[index]).to.have.property('ttl', 30);
expect(bids[index]).to.have.property('netRevenue', true);
}
diff --git a/test/spec/modules/prebidServerBidAdapter_spec.js b/test/spec/modules/prebidServerBidAdapter_spec.js
index b4544a2ec48..d99ec9d421d 100644
--- a/test/spec/modules/prebidServerBidAdapter_spec.js
+++ b/test/spec/modules/prebidServerBidAdapter_spec.js
@@ -1702,6 +1702,24 @@ describe('S2S Adapter', function () {
expect(response).to.have.property('cpm', 0.5);
expect(response).to.not.have.property('vastUrl');
expect(response).to.not.have.property('videoCacheKey');
+ expect(response).to.have.property('ttl', 60);
+ });
+
+ it('respects defaultTtl', function () {
+ const s2sConfig = Object.assign({}, CONFIG, {
+ endpoint: 'https://prebid.adnxs.com/pbs/v1/openrtb2/auction',
+ defaultTtl: 30
+ });
+ config.setConfig({ s2sConfig });
+
+ adapter.callBids(REQUEST, BID_REQUESTS, addBidResponse, done, ajax);
+ server.requests[0].respond(200, {}, JSON.stringify(RESPONSE_OPENRTB));
+
+ sinon.assert.calledOnce(events.emit);
+ const event = events.emit.firstCall.args;
+ sinon.assert.calledOnce(addBidResponse);
+ const response = addBidResponse.firstCall.args[1];
+ expect(response).to.have.property('ttl', 30);
});
it('handles OpenRTB video responses', function () {
@@ -2155,6 +2173,15 @@ describe('S2S Adapter', function () {
})
});
+ it('should set default s2s ttl', function () {
+ config.setConfig({
+ s2sConfig: {
+ defaultTtl: 30
+ }
+ });
+ expect(config.getConfig('s2sConfig').defaultTtl).to.deep.equal(30);
+ });
+
it('should set syncUrlModifier', function () {
config.setConfig({
s2sConfig: {
diff --git a/test/spec/modules/priceFloors_spec.js b/test/spec/modules/priceFloors_spec.js
index 2a816aef104..9d35554c27f 100644
--- a/test/spec/modules/priceFloors_spec.js
+++ b/test/spec/modules/priceFloors_spec.js
@@ -407,6 +407,89 @@ describe('the price floors module', function () {
fetchStatus: undefined
});
});
+ it('should randomly pick a model if floorsSchemaVersion is 2', function () {
+ let inputFloors = {
+ ...basicFloorConfig,
+ data: {
+ floorsSchemaVersion: 2,
+ currency: 'USD',
+ modelGroups: [
+ {
+ modelVersion: 'model-1',
+ modelWeight: 10,
+ schema: {
+ delimiter: '|',
+ fields: ['mediaType']
+ },
+ values: {
+ 'banner': 1.0,
+ '*': 2.5
+ }
+ }, {
+ modelVersion: 'model-2',
+ modelWeight: 40,
+ schema: {
+ delimiter: '|',
+ fields: ['size']
+ },
+ values: {
+ '300x250': 1.0,
+ '*': 2.5
+ }
+ }, {
+ modelVersion: 'model-3',
+ modelWeight: 50,
+ schema: {
+ delimiter: '|',
+ fields: ['domain']
+ },
+ values: {
+ 'www.prebid.org': 1.0,
+ '*': 2.5
+ }
+ }
+ ]
+ }
+ };
+ handleSetFloorsConfig(inputFloors);
+
+ // stub random to give us wanted vals
+ let randValue;
+ sandbox.stub(Math, 'random').callsFake(() => randValue);
+
+ // 0 - 10 should use first model
+ randValue = 0.05;
+ runStandardAuction();
+ validateBidRequests(true, {
+ skipped: false,
+ modelVersion: 'model-1',
+ location: 'setConfig',
+ skipRate: 0,
+ fetchStatus: undefined
+ });
+
+ // 11 - 50 should use second model
+ randValue = 0.40;
+ runStandardAuction();
+ validateBidRequests(true, {
+ skipped: false,
+ modelVersion: 'model-2',
+ location: 'setConfig',
+ skipRate: 0,
+ fetchStatus: undefined
+ });
+
+ // 51 - 100 should use third model
+ randValue = 0.75;
+ runStandardAuction();
+ validateBidRequests(true, {
+ skipped: false,
+ modelVersion: 'model-3',
+ location: 'setConfig',
+ skipRate: 0,
+ fetchStatus: undefined
+ });
+ });
it('should not overwrite previous data object if the new one is bad', function () {
handleSetFloorsConfig({...basicFloorConfig});
handleSetFloorsConfig({
@@ -547,6 +630,44 @@ describe('the price floors module', function () {
fetchStatus: 'success'
});
});
+ it('it should correctly overwrite skipRate with fetch skipRate', function () {
+ // so floors does not skip
+ sandbox.stub(Math, 'random').callsFake(() => 0.99);
+ // init the fake server with response stuff
+ let fetchFloorData = {
+ ...basicFloorData,
+ modelVersion: 'fetch model name', // change the model name
+ };
+ fetchFloorData.skipRate = 95;
+ fakeFloorProvider.respondWith(JSON.stringify(fetchFloorData));
+
+ // run setConfig indicating fetch
+ handleSetFloorsConfig({...basicFloorConfig, auctionDelay: 250, endpoint: {url: 'http://www.fakeFloorProvider.json'}});
+
+ // floor provider should be called
+ expect(fakeFloorProvider.requests.length).to.equal(1);
+ expect(fakeFloorProvider.requests[0].url).to.equal('http://www.fakeFloorProvider.json');
+
+ // start the auction it should delay and not immediately call `continueAuction`
+ runStandardAuction();
+
+ // exposedAdUnits should be undefined if the auction has not continued
+ expect(exposedAdUnits).to.be.undefined;
+
+ // make the fetch respond
+ fakeFloorProvider.respond();
+ expect(exposedAdUnits).to.not.be.undefined;
+
+ // the exposedAdUnits should be from the fetch not setConfig level data
+ // and fetchStatus is success since fetch worked
+ validateBidRequests(true, {
+ skipped: false,
+ modelVersion: 'fetch model name',
+ location: 'fetch',
+ skipRate: 95,
+ fetchStatus: 'success'
+ });
+ });
it('Should not break if floor provider returns 404', function () {
// run setConfig indicating fetch
handleSetFloorsConfig({...basicFloorConfig, auctionDelay: 250, endpoint: {url: 'http://www.fakeFloorProvider.json'}});
@@ -615,6 +736,11 @@ describe('the price floors module', function () {
expect(logErrorSpy.calledOnce).to.equal(true);
});
describe('isFloorsDataValid', function () {
+ it('should return false if unknown floorsSchemaVersion', function () {
+ let inputFloorData = utils.deepClone(basicFloorData);
+ inputFloorData.floorsSchemaVersion = 3;
+ expect(isFloorsDataValid(inputFloorData)).to.to.equal(false);
+ });
it('should work correctly for fields array', function () {
let inputFloorData = utils.deepClone(basicFloorData);
expect(isFloorsDataValid(inputFloorData)).to.to.equal(true);
@@ -670,6 +796,66 @@ describe('the price floors module', function () {
expect(isFloorsDataValid(inputFloorData)).to.to.equal(true);
expect(inputFloorData.values).to.deep.equal({ 'test-div-1|native': 1.0 });
});
+ it('should work correctly for floorsSchemaVersion 2', function () {
+ let inputFloorData = {
+ floorsSchemaVersion: 2,
+ currency: 'USD',
+ modelGroups: [
+ {
+ modelVersion: 'model-1',
+ modelWeight: 10,
+ schema: {
+ delimiter: '|',
+ fields: ['mediaType']
+ },
+ values: {
+ 'banner': 1.0,
+ '*': 2.5
+ }
+ }, {
+ modelVersion: 'model-2',
+ modelWeight: 40,
+ schema: {
+ delimiter: '|',
+ fields: ['size']
+ },
+ values: {
+ '300x250': 1.0,
+ '*': 2.5
+ }
+ }, {
+ modelVersion: 'model-3',
+ modelWeight: 50,
+ schema: {
+ delimiter: '|',
+ fields: ['domain']
+ },
+ values: {
+ 'www.prebid.org': 1.0,
+ '*': 2.5
+ }
+ }
+ ]
+ };
+ expect(isFloorsDataValid(inputFloorData)).to.to.equal(true);
+
+ // remove one of the modelWeight's and it should be false
+ delete inputFloorData.modelGroups[1].modelWeight;
+ expect(isFloorsDataValid(inputFloorData)).to.to.equal(false);
+ inputFloorData.modelGroups[1].modelWeight = 40;
+
+ // remove values from a model and it should not validate
+ const tempValues = {...inputFloorData.modelGroups[0].values};
+ delete inputFloorData.modelGroups[0].values;
+ expect(isFloorsDataValid(inputFloorData)).to.to.equal(false);
+ inputFloorData.modelGroups[0].values = tempValues;
+
+ // modelGroups should be an array and have at least one entry
+ delete inputFloorData.modelGroups;
+ expect(isFloorsDataValid(inputFloorData)).to.to.equal(false);
+ inputFloorData.modelGroups = [];
+ expect(isFloorsDataValid(inputFloorData)).to.to.equal(false);
+ });
});
describe('getFloor', function () {
let bidRequest = {
diff --git a/test/spec/modules/proxistoreBidAdapter_spec.js b/test/spec/modules/proxistoreBidAdapter_spec.js
index e18262ae797..410c3c59fb6 100644
--- a/test/spec/modules/proxistoreBidAdapter_spec.js
+++ b/test/spec/modules/proxistoreBidAdapter_spec.js
@@ -1,5 +1,5 @@
import { expect } from 'chai';
-let spec = require('modules/proxistoreBidAdapter');
+let { spec } = require('modules/proxistoreBidAdapter');
const BIDDER_CODE = 'proxistore';
describe('ProxistoreBidAdapter', function () {
@@ -28,7 +28,21 @@ describe('ProxistoreBidAdapter', function () {
transactionId: 511916005
};
describe('isBidRequestValid', function () {
- it('it should be true if required params are presents', function () {
+ it('it should be true if required params are presents and there is no info in the local storage', function () {
+ expect(spec.isBidRequestValid(bid)).to.equal(true);
+ });
+
+ it('it should be false if the value in the localstorage is less than 5minutes of the actual time', function() {
+ const date = new Date();
+ date.setMinutes(date.getMinutes() - 1)
+ localStorage.setItem(`PX_NoAds_${bid.params.website}`, date)
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
+ });
+
+ it('it should be true if the value in the localstorage is more than 5minutes of the actual time', function() {
+ const date = new Date();
+ date.setMinutes(date.getMinutes() - 10)
+ localStorage.setItem(`PX_NoAds_${bid.params.website}`, date)
expect(spec.isBidRequestValid(bid)).to.equal(true);
});
});
@@ -97,7 +111,11 @@ describe('ProxistoreBidAdapter', function () {
expect(interpretedResponse.requestId).equal('923756713');
expect(interpretedResponse.netRevenue).to.be.true;
expect(interpretedResponse.netRevenue).to.be.true;
- })
+ });
+ it('should have a value in the local storage if the response is empty', function() {
+ spec.interpretResponse(badResponse, bid);
+ expect(localStorage.getItem(`PX_NoAds_${bid.params.website}`)).to.be.string;
+ });
});
describe('interpretResponse', function () {
diff --git a/test/spec/modules/pubmaticBidAdapter_spec.js b/test/spec/modules/pubmaticBidAdapter_spec.js
index 45259767133..7a33df6fdfa 100644
--- a/test/spec/modules/pubmaticBidAdapter_spec.js
+++ b/test/spec/modules/pubmaticBidAdapter_spec.js
@@ -1350,47 +1350,6 @@ describe('PubMatic adapter', function () {
});
});
- describe('Digitrust Id', function() {
- it('send the digitrust id if it is present', function() {
- bidRequests[0].userId = {};
- bidRequests[0].userId.digitrustid = {data: {id: 'digitrust_user_id'}};
- bidRequests[0].userIdAsEids = createEidsArray(bidRequests[0].userId);
- let request = spec.buildRequests(bidRequests, {});
- let data = JSON.parse(request.data);
- expect(data.user.eids).to.deep.equal([{
- 'source': 'digitru.st',
- 'uids': [{
- 'id': 'digitrust_user_id',
- 'atype': 1
- }]
- }]);
- });
-
- it('do not pass if not string', function() {
- bidRequests[0].userId = {};
- bidRequests[0].userId.digitrustid = {data: {id: 1}};
- bidRequests[0].userIdAsEids = createEidsArray(bidRequests[0].userId);
- let request = spec.buildRequests(bidRequests, {});
- let data = JSON.parse(request.data);
- expect(data.user.eids).to.equal(undefined);
- bidRequests[0].userId.digitrustid = {data: {id: []}};
- bidRequests[0].userIdAsEids = createEidsArray(bidRequests[0].userId);
- request = spec.buildRequests(bidRequests, {});
- data = JSON.parse(request.data);
- expect(data.user.eids).to.equal(undefined);
- bidRequests[0].userId.digitrustid = {data: {id: null}};
- bidRequests[0].userIdAsEids = createEidsArray(bidRequests[0].userId);
- request = spec.buildRequests(bidRequests, {});
- data = JSON.parse(request.data);
- expect(data.user.eids).to.equal(undefined);
- bidRequests[0].userId.digitrustid = {data: {id: {}}};
- bidRequests[0].userIdAsEids = createEidsArray(bidRequests[0].userId);
- request = spec.buildRequests(bidRequests, {});
- data = JSON.parse(request.data);
- expect(data.user.eids).to.equal(undefined);
- });
- });
-
describe('ID5 Id', function() {
it('send the id5 id if it is present', function() {
bidRequests[0].userId = {};
diff --git a/test/spec/modules/quantumdexBidAdapter_spec.js b/test/spec/modules/quantumdexBidAdapter_spec.js
index ef8791cca57..82429cbedae 100644
--- a/test/spec/modules/quantumdexBidAdapter_spec.js
+++ b/test/spec/modules/quantumdexBidAdapter_spec.js
@@ -235,14 +235,14 @@ describe('QuantumdexBidAdapter', function () {
it('should return a properly formatted request', function () {
const bidRequests = spec.buildRequests(bidRequest, bidderRequests)
- expect(bidRequests.url).to.equal('https://useast.quantumdex.io/auction/adapter')
+ expect(bidRequests.url).to.equal('https://useast.quantumdex.io/auction/quantumdex')
expect(bidRequests.method).to.equal('POST')
expect(bidRequests.bidderRequests).to.eql(bidRequest);
})
it('should return a properly formatted request with GDPR applies set to true', function () {
const bidRequests = spec.buildRequests(bidRequest, bidderRequests)
- expect(bidRequests.url).to.equal('https://useast.quantumdex.io/auction/adapter')
+ expect(bidRequests.url).to.equal('https://useast.quantumdex.io/auction/quantumdex')
expect(bidRequests.method).to.equal('POST')
expect(bidRequests.data.gdpr.gdprApplies).to.equal('true')
expect(bidRequests.data.gdpr.consentString).to.equal('BOJ/P2HOJ/P2HABABMAAAAAZ+A==')
@@ -251,7 +251,7 @@ describe('QuantumdexBidAdapter', function () {
it('should return a properly formatted request with GDPR applies set to false', function () {
bidderRequests.gdprConsent.gdprApplies = false;
const bidRequests = spec.buildRequests(bidRequest, bidderRequests)
- expect(bidRequests.url).to.equal('https://useast.quantumdex.io/auction/adapter')
+ expect(bidRequests.url).to.equal('https://useast.quantumdex.io/auction/quantumdex')
expect(bidRequests.method).to.equal('POST')
expect(bidRequests.data.gdpr.gdprApplies).to.equal('false')
expect(bidRequests.data.gdpr.consentString).to.equal('BOJ/P2HOJ/P2HABABMAAAAAZ+A==')
@@ -271,7 +271,7 @@ describe('QuantumdexBidAdapter', function () {
}
};
const bidRequests = spec.buildRequests(bidRequest, bidderRequests)
- expect(bidRequests.url).to.equal('https://useast.quantumdex.io/auction/adapter')
+ expect(bidRequests.url).to.equal('https://useast.quantumdex.io/auction/quantumdex')
expect(bidRequests.method).to.equal('POST')
expect(bidRequests.data.gdpr.gdprApplies).to.equal('false')
expect(bidRequests.data.gdpr).to.not.include.keys('consentString')
@@ -291,7 +291,7 @@ describe('QuantumdexBidAdapter', function () {
}
};
const bidRequests = spec.buildRequests(bidRequest, bidderRequests)
- expect(bidRequests.url).to.equal('https://useast.quantumdex.io/auction/adapter')
+ expect(bidRequests.url).to.equal('https://useast.quantumdex.io/auction/quantumdex')
expect(bidRequests.method).to.equal('POST')
expect(bidRequests.data.gdpr.gdprApplies).to.equal('true')
expect(bidRequests.data.gdpr).to.not.include.keys('consentString')
@@ -309,7 +309,7 @@ describe('QuantumdexBidAdapter', function () {
describe('.interpretResponse', function () {
const bidRequests = {
'method': 'POST',
- 'url': 'https://useast.quantumdex.io/auction/adapter',
+ 'url': 'https://useast.quantumdex.io/auction/quantumdex',
'withCredentials': true,
'data': {
'device': {
diff --git a/test/spec/modules/relaidoBidAdapter_spec.js b/test/spec/modules/relaidoBidAdapter_spec.js
index 492f7d2ca08..cd4918460db 100644
--- a/test/spec/modules/relaidoBidAdapter_spec.js
+++ b/test/spec/modules/relaidoBidAdapter_spec.js
@@ -136,7 +136,7 @@ describe('RelaidoAdapter', function () {
expect(bidRequests).to.have.lengthOf(1);
const request = bidRequests[0];
expect(request.method).to.equal('GET');
- expect(request.url).to.equal('https://api.relaido.jp/vast/v1/out/bid/100000');
+ expect(request.url).to.equal('https://api.relaido.jp/bid/v1/prebid/100000');
expect(request.bidId).to.equal(bidRequest.bidId);
expect(request.width).to.equal(bidRequest.mediaTypes.video.playerSize[0][0]);
expect(request.height).to.equal(bidRequest.mediaTypes.video.playerSize[0][1]);
diff --git a/test/spec/modules/richaudienceBidAdapter_spec.js b/test/spec/modules/richaudienceBidAdapter_spec.js
index 2bc699b4640..f18e67a3ac5 100644
--- a/test/spec/modules/richaudienceBidAdapter_spec.js
+++ b/test/spec/modules/richaudienceBidAdapter_spec.js
@@ -29,12 +29,12 @@ describe('Richaudience adapter tests', function () {
user: {}
}];
- var DEFAULT_PARAMS_VIDEO = [{
+ var DEFAULT_PARAMS_VIDEO_IN = [{
adUnitCode: 'test-div',
bidId: '2c7c8e9c900244',
mediaTypes: {
video: {
- context: 'instream', // or 'outstream'
+ context: 'instream',
playerSize: [640, 480],
mimes: ['video/mp4']
}
@@ -52,6 +52,57 @@ describe('Richaudience adapter tests', function () {
user: {}
}];
+ var DEFAULT_PARAMS_VIDEO_OUT = [{
+ adUnitCode: 'test-div',
+ bidId: '2c7c8e9c900244',
+ mediaTypes: {
+ video: {
+ context: 'outstream',
+ playerSize: [640, 480],
+ mimes: ['video/mp4']
+ }
+ },
+ bidder: 'richaudience',
+ params: {
+ bidfloor: 0.5,
+ pid: 'ADb1f40rmi',
+ supplyType: 'site'
+ },
+ auctionId: '0cb3144c-d084-4686-b0d6-f5dbe917c563',
+ bidRequestsCount: 1,
+ bidderRequestId: '1858b7382993ca',
+ transactionId: '29df2112-348b-4961-8863-1b33684d95e6',
+ user: {}
+ }];
+
+ var DEFAULT_PARAMS_VIDEO_OUT_PARAMS = [{
+ adUnitCode: 'test-div',
+ bidId: '2c7c8e9c900244',
+ mediaTypes: {
+ video: {
+ context: 'outstream',
+ playerSize: [640, 480],
+ mimes: ['video/mp4']
+ }
+ },
+ bidder: 'richaudience',
+ params: {
+ bidfloor: 0.5,
+ pid: 'ADb1f40rmi',
+ supplyType: 'site',
+ player: {
+ init: 'close',
+ end: 'close',
+ skin: 'dark'
+ }
+ },
+ auctionId: '0cb3144c-d084-4686-b0d6-f5dbe917c563',
+ bidRequestsCount: 1,
+ bidderRequestId: '1858b7382993ca',
+ transactionId: '29df2112-348b-4961-8863-1b33684d95e6',
+ user: {}
+ }];
+
var DEFAULT_PARAMS_APP = [{
adUnitCode: 'test-div',
bidId: '2c7c8e9c900244',
@@ -191,6 +242,45 @@ describe('Richaudience adapter tests', function () {
expect(requestContent).to.have.property('numIframes').and.to.equal(0);
})
+ it('Verify build request to prebid video inestream', function() {
+ const request = spec.buildRequests(DEFAULT_PARAMS_VIDEO_IN, {
+ gdprConsent: {
+ consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
+ gdprApplies: true
+ },
+ refererInfo: {
+ referer: 'https://domain.com',
+ numIframes: 0
+ }
+ });
+
+ expect(request[0]).to.have.property('method').and.to.equal('POST');
+ const requestContent = JSON.parse(request[0].data);
+
+ expect(requestContent).to.have.property('demand').and.to.equal('video');
+ expect(requestContent.videoData).to.have.property('format').and.to.equal('instream');
+ // expect(requestContent.videoData.playerSize[0][0]).to.equal('640');
+ // expect(requestContent.videoData.playerSize[0][0]).to.equal('480');
+ })
+
+ it('Verify build request to prebid video outstream', function() {
+ const request = spec.buildRequests(DEFAULT_PARAMS_VIDEO_OUT, {
+ gdprConsent: {
+ consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
+ gdprApplies: true
+ },
+ refererInfo: {
+ referer: 'https://domain.com',
+ numIframes: 0
+ }
+ });
+
+ expect(request[0]).to.have.property('method').and.to.equal('POST');
+ const requestContent = JSON.parse(request[0].data);
+
+ expect(requestContent.videoData).to.have.property('format').and.to.equal('outstream');
+ })
+
describe('gdpr test', function () {
it('Verify build request with GDPR', function () {
config.setConfig({
@@ -502,8 +592,26 @@ describe('Richaudience adapter tests', function () {
expect(bid.dealId).to.equal('dealId');
});
- it('no banner media response', function () {
- const request = spec.buildRequests(DEFAULT_PARAMS_NEW_SIZES, {
+ it('no banner media response inestream', function () {
+ const request = spec.buildRequests(DEFAULT_PARAMS_VIDEO_IN, {
+ gdprConsent: {
+ consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
+ gdprApplies: true
+ },
+ refererInfo: {
+ referer: 'https://domain.com',
+ numIframes: 0
+ }
+ });
+
+ const bids = spec.interpretResponse(BID_RESPONSE_VIDEO, request[0]);
+ const bid = bids[0];
+ expect(bid.mediaType).to.equal('video');
+ expect(bid.vastXml).to.equal('
');
+ });
+
+ it('no banner media response outstream', function () {
+ const request = spec.buildRequests(DEFAULT_PARAMS_VIDEO_OUT, {
gdprConsent: {
consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
gdprApplies: true
@@ -516,7 +624,9 @@ describe('Richaudience adapter tests', function () {
const bids = spec.interpretResponse(BID_RESPONSE_VIDEO, request[0]);
const bid = bids[0];
+ expect(bid.mediaType).to.equal('video');
expect(bid.vastXml).to.equal('
');
+ expect(bid.renderer.url).to.equal('https://cdn3.richaudience.com/prebidVideo/player.js');
});
it('Verifies bidder_code', function () {
diff --git a/test/spec/modules/sovrnBidAdapter_spec.js b/test/spec/modules/sovrnBidAdapter_spec.js
index c82cc32207a..54ccff870eb 100644
--- a/test/spec/modules/sovrnBidAdapter_spec.js
+++ b/test/spec/modules/sovrnBidAdapter_spec.js
@@ -70,12 +70,17 @@ describe('sovrnBidAdapter', function() {
});
it('sets the proper banner object', function() {
- const payload = JSON.parse(request.data);
+ const payload = JSON.parse(request.data)
expect(payload.imp[0].banner.format).to.deep.equal([{w: 300, h: 250}, {w: 300, h: 600}])
expect(payload.imp[0].banner.w).to.equal(1)
expect(payload.imp[0].banner.h).to.equal(1)
})
+ it('includes the ad unit code int the request', function() {
+ const payload = JSON.parse(request.data);
+ expect(payload.imp[0].adunitcode).to.equal('adunit-code')
+ })
+
it('accepts a single array as a size', function() {
const singleSize = [{
'bidder': 'sovrn',
@@ -234,7 +239,7 @@ describe('sovrnBidAdapter', function() {
expect(data.source.ext.schain.nodes.length).to.equal(1)
});
- it('should add digitrust data if present', function() {
+ it('should add the unifiedID if present', function() {
const digitrustRequests = [{
'bidder': 'sovrn',
'params': {
@@ -249,12 +254,7 @@ describe('sovrnBidAdapter', function() {
'bidderRequestId': '22edbae2733bf6',
'auctionId': '1d1a030790a475',
'userId': {
- 'digitrustid': {
- 'data': {
- 'id': 'digitrust-id-123',
- 'keyv': 4
- }
- }
+ 'tdid': 'SOMESORTOFID',
}
}].concat(bidRequests);
const bidderRequest = {
@@ -262,13 +262,13 @@ describe('sovrnBidAdapter', function() {
referer: 'http://example.com/page.html',
}
};
- const data = JSON.parse(spec.buildRequests(digitrustRequests, bidderRequest).data);
- expect(data.user.ext.digitrust.id).to.equal('digitrust-id-123');
- expect(data.user.ext.digitrust.keyv).to.equal(4);
- });
+ const data = JSON.parse(spec.buildRequests(digitrustRequests, bidderRequest).data);
+ expect(data.user.ext.eids[0].source).to.equal('adserver.org')
+ expect(data.user.ext.eids[0].uids[0].id).to.equal('SOMESORTOFID')
+ expect(data.user.ext.eids[0].uids[0].ext.rtiPartner).to.equal('TDID')
+ })
});
-
describe('interpretResponse', function () {
let response;
beforeEach(function () {
diff --git a/test/spec/modules/synacormediaBidAdapter_spec.js b/test/spec/modules/synacormediaBidAdapter_spec.js
index f6fa7a20594..e15481d47e5 100644
--- a/test/spec/modules/synacormediaBidAdapter_spec.js
+++ b/test/spec/modules/synacormediaBidAdapter_spec.js
@@ -68,9 +68,13 @@ describe('synacormediaBidAdapter ', function () {
},
mediaTypes: {
banner: {
- h: 600,
- pos: 0,
- w: 300,
+ format: [
+ {
+ w: 300,
+ h: 600
+ }
+ ],
+ pos: 0
}
},
};
@@ -173,21 +177,19 @@ describe('synacormediaBidAdapter ', function () {
let expectedDataImp1 = {
banner: {
- h: 250,
- pos: 0,
- w: 300,
- },
- id: 'b9876abcd-300x250',
- tagid: '1234',
- bidfloor: 0.5
- };
- let expectedDataImp2 = {
- banner: {
- h: 600,
- pos: 0,
- w: 300,
+ format: [
+ {
+ h: 250,
+ w: 300
+ },
+ {
+ h: 600,
+ w: 300
+ }
+ ],
+ pos: 0
},
- id: 'b9876abcd-300x600',
+ id: 'b9876abcd',
tagid: '1234',
bidfloor: 0.5
};
@@ -201,7 +203,7 @@ describe('synacormediaBidAdapter ', function () {
expect(req.url).to.contain('https://prebid.technoratimedia.com/openrtb/bids/prebid?');
expect(req.data).to.exist.and.to.be.an('object');
expect(req.data.id).to.equal('xyz123');
- expect(req.data.imp).to.eql([expectedDataImp1, expectedDataImp2]);
+ expect(req.data.imp).to.eql([expectedDataImp1]);
// video test
let reqVideo = spec.buildRequests([validBidRequestVideo], bidderRequestVideo);
@@ -230,13 +232,17 @@ describe('synacormediaBidAdapter ', function () {
expect(req).to.have.property('url');
expect(req.url).to.contain('https://prebid.technoratimedia.com/openrtb/bids/prebid?');
expect(req.data.id).to.equal('xyz123');
- expect(req.data.imp).to.eql([expectedDataImp1, expectedDataImp2, {
+ expect(req.data.imp).to.eql([expectedDataImp1, {
banner: {
- h: 600,
- pos: 0,
- w: 300,
+ format: [
+ {
+ h: 600,
+ w: 300
+ }
+ ],
+ pos: 0
},
- id: 'bfoobar-300x600',
+ id: 'bfoobar',
tagid: '5678',
bidfloor: 0.5
}]);
@@ -260,11 +266,15 @@ describe('synacormediaBidAdapter ', function () {
expect(req.data.imp).to.eql([
{
banner: {
- h: 250,
- pos: 0,
- w: 300,
+ format: [
+ {
+ h: 250,
+ w: 300
+ }
+ ],
+ pos: 0
},
- id: 'bfoobar-300x250',
+ id: 'bfoobar',
tagid: '5678',
bidfloor: 0.5
}
@@ -289,11 +299,15 @@ describe('synacormediaBidAdapter ', function () {
expect(req.data.imp).to.eql([
{
banner: {
- h: 250,
- pos: 0,
- w: 300,
+ format: [
+ {
+ h: 250,
+ w: 300
+ }
+ ],
+ pos: 0
},
- id: 'b9876abcd-300x250',
+ id: 'b9876abcd',
tagid: '1234',
}
]);
@@ -316,11 +330,15 @@ describe('synacormediaBidAdapter ', function () {
expect(req.data.imp).to.eql([
{
banner: {
- h: 250,
- pos: 0,
- w: 300,
+ format: [
+ {
+ h: 250,
+ w: 300
+ }
+ ],
+ pos: 0
},
- id: 'b9876abcd-300x250',
+ id: 'b9876abcd',
tagid: '1234',
}
]);
@@ -344,11 +362,15 @@ describe('synacormediaBidAdapter ', function () {
expect(req.data.imp).to.eql([
{
banner: {
- h: 250,
- w: 300,
- pos: 1,
+ format: [
+ {
+ h: 250,
+ w: 300
+ }
+ ],
+ pos: 1
},
- id: 'b9876abcd-300x250',
+ id: 'b9876abcd',
tagid: '1234'
}
]);
@@ -371,11 +393,15 @@ describe('synacormediaBidAdapter ', function () {
expect(req.data.imp).to.eql([
{
banner: {
- h: 250,
- w: 300,
- pos: 0,
+ format: [
+ {
+ h: 250,
+ w: 300
+ }
+ ],
+ pos: 0
},
- id: 'b9876abcd-300x250',
+ id: 'b9876abcd',
tagid: '1234'
}
]);
diff --git a/test/spec/modules/teadsBidAdapter_spec.js b/test/spec/modules/teadsBidAdapter_spec.js
index 6854c9ae94f..cc5bbb840a9 100644
--- a/test/spec/modules/teadsBidAdapter_spec.js
+++ b/test/spec/modules/teadsBidAdapter_spec.js
@@ -166,6 +166,29 @@ describe('teadsBidAdapter', () => {
expect(payload.referrer).to.deep.equal('https://example.com/page.html')
});
+ it('should add networkBandwidth info to payload', function () {
+ const request = spec.buildRequests(bidRequests, bidderResquestDefault);
+ const payload = JSON.parse(request.data);
+
+ const bandwidth = window.navigator && window.navigator.connection && window.navigator.connection.downlink;
+
+ expect(payload.networkBandwidth).to.exist;
+
+ if (bandwidth) {
+ expect(payload.networkBandwidth).to.deep.equal(bandwidth.toString());
+ } else {
+ expect(payload.networkBandwidth).to.deep.equal('');
+ }
+ });
+
+ it('should add pageReferrer info to payload', function () {
+ const request = spec.buildRequests(bidRequests, bidderResquestDefault);
+ const payload = JSON.parse(request.data);
+
+ expect(payload.pageReferrer).to.exist;
+ expect(payload.pageReferrer).to.deep.equal(document.referrer);
+ });
+
it('should send GDPR to endpoint with 11 status', function() {
let consentString = 'JRJ8RKfDeBNsERRDCSAAZ+A==';
let bidderRequest = {
diff --git a/test/spec/modules/userId_spec.js b/test/spec/modules/userId_spec.js
index 8ce81ea85b0..5dda322f3c8 100644
--- a/test/spec/modules/userId_spec.js
+++ b/test/spec/modules/userId_spec.js
@@ -971,54 +971,6 @@ describe('User ID', function() {
done();
}, {adUnits});
});
- it('test hook from id5id cookies when refresh needed', function(done) {
- // simulate existing browser local storage values
- coreStorage.setCookie('id5id', JSON.stringify({'ID5ID': 'testid5id'}), (new Date(Date.now() + 5000).toUTCString()));
- coreStorage.setCookie('id5id_last', (new Date(Date.now() - 7200 * 1000)).toUTCString(), (new Date(Date.now() + 5000).toUTCString()));
-
- sinon.stub(utils, 'logError'); // getId should failed with a logError as it has no partnerId
-
- setSubmoduleRegistry([id5IdSubmodule]);
- init(config);
- config.setConfig(getConfigMock(['id5Id', 'id5id', 'cookie', 10, 3600]));
-
- requestBidsHook(function() {
- adUnits.forEach(unit => {
- unit.bids.forEach(bid => {
- expect(bid).to.have.deep.nested.property('userId.id5id');
- expect(bid.userId.id5id).to.equal('testid5id');
- expect(bid.userIdAsEids[0]).to.deep.equal({
- source: 'id5-sync.com',
- uids: [{id: 'testid5id', atype: 1}]
- });
- });
- });
- sinon.assert.calledOnce(utils.logError);
- coreStorage.setCookie('id5id', '', EXPIRED_COOKIE_DATE);
- utils.logError.restore();
- done();
- }, {adUnits});
- });
-
- it('test hook from id5id value-based config', function(done) {
- setSubmoduleRegistry([id5IdSubmodule]);
- init(config);
- config.setConfig(getConfigValueMock('id5Id', {'id5id': 'testid5id'}));
-
- requestBidsHook(function() {
- adUnits.forEach(unit => {
- unit.bids.forEach(bid => {
- expect(bid).to.have.deep.nested.property('userId.id5id');
- expect(bid.userId.id5id).to.equal('testid5id');
- expect(bid.userIdAsEids[0]).to.deep.equal({
- source: 'id5-sync.com',
- uids: [{id: 'testid5id', atype: 1}]
- });
- });
- });
- done();
- }, {adUnits});
- });
it('test hook from liveIntentId html5', function(done) {
// simulate existing browser local storage values
@@ -1126,7 +1078,7 @@ describe('User ID', function() {
it('test hook when pubCommonId, unifiedId, id5Id, identityLink, britepoolId, netId and sharedId have data to pass', function(done) {
coreStorage.setCookie('pubcid', 'testpubcid', (new Date(Date.now() + 5000).toUTCString()));
coreStorage.setCookie('unifiedid', JSON.stringify({'TDID': 'testunifiedid'}), (new Date(Date.now() + 5000).toUTCString()));
- coreStorage.setCookie('id5id', JSON.stringify({'ID5ID': 'testid5id'}), (new Date(Date.now() + 5000).toUTCString()));
+ coreStorage.setCookie('id5id', JSON.stringify({'universal_uid': 'testid5id'}), (new Date(Date.now() + 5000).toUTCString()));
coreStorage.setCookie('idl_env', 'AiGNC8Z5ONyZKSpIPf', (new Date(Date.now() + 5000).toUTCString()));
coreStorage.setCookie('britepoolid', JSON.stringify({'primaryBPID': 'testbritepoolid'}), (new Date(Date.now() + 5000).toUTCString()));
coreStorage.setCookie('netId', JSON.stringify({'netId': 'testnetId'}), (new Date(Date.now() + 5000).toUTCString()));
@@ -1203,7 +1155,7 @@ describe('User ID', function() {
it('test hook when pubCommonId, unifiedId, id5Id, britepoolId, netId and sharedId have their modules added before and after init', function(done) {
coreStorage.setCookie('pubcid', 'testpubcid', (new Date(Date.now() + 5000).toUTCString()));
coreStorage.setCookie('unifiedid', JSON.stringify({'TDID': 'cookie-value-add-module-variations'}), new Date(Date.now() + 5000).toUTCString());
- coreStorage.setCookie('id5id', JSON.stringify({'ID5ID': 'testid5id'}), (new Date(Date.now() + 5000).toUTCString()));
+ coreStorage.setCookie('id5id', JSON.stringify({'universal_uid': 'testid5id'}), (new Date(Date.now() + 5000).toUTCString()));
coreStorage.setCookie('idl_env', 'AiGNC8Z5ONyZKSpIPf', new Date(Date.now() + 5000).toUTCString());
coreStorage.setCookie('britepoolid', JSON.stringify({'primaryBPID': 'testbritepoolid'}), (new Date(Date.now() + 5000).toUTCString()));
coreStorage.setCookie('netId', JSON.stringify({'netId': 'testnetId'}), (new Date(Date.now() + 5000).toUTCString()));
@@ -1296,7 +1248,7 @@ describe('User ID', function() {
it('should add new id system ', function(done) {
coreStorage.setCookie('pubcid', 'testpubcid', (new Date(Date.now() + 5000).toUTCString()));
coreStorage.setCookie('unifiedid', JSON.stringify({'TDID': 'cookie-value-add-module-variations'}), new Date(Date.now() + 5000).toUTCString());
- coreStorage.setCookie('id5id', JSON.stringify({'ID5ID': 'testid5id'}), (new Date(Date.now() + 5000).toUTCString()));
+ coreStorage.setCookie('id5id', JSON.stringify({'universal_uid': 'testid5id'}), (new Date(Date.now() + 5000).toUTCString()));
coreStorage.setCookie('idl_env', 'AiGNC8Z5ONyZKSpIPf', new Date(Date.now() + 5000).toUTCString());
coreStorage.setCookie('britepoolid', JSON.stringify({'primaryBPID': 'testbritepoolid'}), (new Date(Date.now() + 5000).toUTCString()));
coreStorage.setCookie('netId', JSON.stringify({'netId': 'testnetId'}), new Date(Date.now() + 5000).toUTCString());
diff --git a/test/spec/modules/valueimpressionBidAdapter_spec.js b/test/spec/modules/valueimpressionBidAdapter_spec.js
deleted file mode 100644
index 974d233af74..00000000000
--- a/test/spec/modules/valueimpressionBidAdapter_spec.js
+++ /dev/null
@@ -1,604 +0,0 @@
-import { expect } from 'chai'
-import { spec } from 'modules/valueimpressionBidAdapter.js'
-import { newBidder } from 'src/adapters/bidderFactory.js'
-import { userSync } from '../../../src/userSync.js';
-
-describe('ValueimpressionBidAdapter', function () {
- const adapter = newBidder(spec)
-
- describe('.code', function () {
- it('should return a bidder code of valueimpression', function () {
- expect(spec.code).to.equal('valueimpression')
- })
- })
-
- describe('inherited functions', function () {
- it('should exist and be a function', function () {
- expect(adapter.callBids).to.exist.and.to.be.a('function')
- })
- })
-
- describe('.isBidRequestValid', function () {
- it('should return false if there are no params', () => {
- const bid = {
- 'bidder': 'valueimpression',
- 'adUnitCode': 'adunit-code',
- 'mediaTypes': {
- banner: {
- sizes: [[300, 250], [300, 600]]
- }
- },
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '1d1a030790a475',
- };
- expect(spec.isBidRequestValid(bid)).to.equal(false);
- });
-
- it('should return false if there is no siteId param', () => {
- const bid = {
- 'bidder': 'valueimpression',
- 'adUnitCode': 'adunit-code',
- params: {
- site_id: '1a2b3c4d5e6f1a2b3c4d',
- },
- 'mediaTypes': {
- banner: {
- sizes: [[300, 250], [300, 600]]
- }
- },
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '1d1a030790a475',
- };
- expect(spec.isBidRequestValid(bid)).to.equal(false);
- });
-
- it('should return false if there is no mediaTypes', () => {
- const bid = {
- 'bidder': 'valueimpression',
- 'adUnitCode': 'adunit-code',
- params: {
- siteId: '1a2b3c4d5e6f1a2b3c4d'
- },
- 'mediaTypes': {
- },
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '1d1a030790a475',
- };
- expect(spec.isBidRequestValid(bid)).to.equal(false);
- });
-
- it('should return true if the bid is valid', () => {
- const bid = {
- 'bidder': 'valueimpression',
- 'adUnitCode': 'adunit-code',
- params: {
- siteId: '1a2b3c4d5e6f1a2b3c4d'
- },
- 'mediaTypes': {
- banner: {
- sizes: [[300, 250], [300, 600]]
- }
- },
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '1d1a030790a475',
- };
- expect(spec.isBidRequestValid(bid)).to.equal(true);
- });
-
- describe('banner', () => {
- it('should return false if there are no banner sizes', () => {
- const bid = {
- 'bidder': 'valueimpression',
- 'adUnitCode': 'adunit-code',
- params: {
- siteId: '1a2b3c4d5e6f1a2b3c4d'
- },
- 'mediaTypes': {
- banner: {
-
- }
- },
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '1d1a030790a475',
- };
- expect(spec.isBidRequestValid(bid)).to.equal(false);
- });
-
- it('should return true if there is banner sizes', () => {
- const bid = {
- 'bidder': 'valueimpression',
- 'adUnitCode': 'adunit-code',
- params: {
- siteId: '1a2b3c4d5e6f1a2b3c4d'
- },
- 'mediaTypes': {
- banner: {
- sizes: [[300, 250], [300, 600]]
- }
- },
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '1d1a030790a475',
- };
- expect(spec.isBidRequestValid(bid)).to.equal(true);
- });
- });
-
- describe('video', () => {
- it('should return false if there is no playerSize defined in the video mediaType', () => {
- const bid = {
- 'bidder': 'valueimpression',
- 'adUnitCode': 'adunit-code',
- params: {
- siteId: '1a2b3c4d5e6f1a2b3c4d',
- sizes: [[300, 250], [300, 600]]
- },
- 'mediaTypes': {
- video: {
- context: 'instream'
- }
- },
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '1d1a030790a475',
- };
- expect(spec.isBidRequestValid(bid)).to.equal(false);
- });
-
- it('should return true if there is playerSize defined on the video mediaType', () => {
- const bid = {
- 'bidder': 'valueimpression',
- 'adUnitCode': 'adunit-code',
- params: {
- siteId: '1a2b3c4d5e6f1a2b3c4d',
- },
- 'mediaTypes': {
- video: {
- context: 'instream',
- playerSize: [[640, 480]]
- }
- },
- 'bidId': '30b31c1838de1e',
- 'bidderRequestId': '22edbae2733bf6',
- 'auctionId': '1d1a030790a475',
- };
- expect(spec.isBidRequestValid(bid)).to.equal(true);
- });
- });
- });
-
- describe('.buildRequests', function () {
- beforeEach(function () {
- sinon.stub(userSync, 'canBidderRegisterSync');
- });
- afterEach(function () {
- userSync.canBidderRegisterSync.restore();
- });
- let bidRequest = [{
- 'schain': {
- 'ver': '1.0',
- 'complete': 1,
- 'nodes': [
- {
- 'asi': 'indirectseller.com',
- 'sid': '00001',
- 'hp': 1
- },
- {
- 'asi': 'indirectseller-2.com',
- 'sid': '00002',
- 'hp': 0
- },
- ]
- },
- 'bidder': 'valueimpression',
- 'params': {
- 'siteId': '1a2b3c4d5e6f1a2b3c4d',
- },
- 'adUnitCode': 'adunit-code-1',
- 'sizes': [[300, 250], [300, 600]],
- 'targetKey': 0,
- 'bidId': '30b31c1838de1f',
- },
- {
- 'bidder': 'valueimpression',
- 'params': {
- 'ad_unit': '/7780971/sparks_prebid_LB',
- 'sizes': [[300, 250], [300, 600]],
- 'referrer': 'overrides_top_window_location'
- },
- 'adUnitCode': 'adunit-code-2',
- 'sizes': [[120, 600], [300, 600], [160, 600]],
- 'targetKey': 1,
- 'bidId': '30b31c1838de1e',
- }];
-
- let bidderRequests = {
- 'gdprConsent': {
- 'consentString': 'BOJ/P2HOJ/P2HABABMAAAAAZ+A==',
- 'vendorData': {},
- 'gdprApplies': true
- },
- 'refererInfo': {
- 'numIframes': 0,
- 'reachedTop': true,
- 'referer': 'https://example.com',
- 'stack': ['https://example.com']
- },
- uspConsent: 'someCCPAString'
- };
-
- it('should return a properly formatted request', function () {
- const bidRequests = spec.buildRequests(bidRequest, bidderRequests)
- expect(bidRequests.url).to.equal('https://useast.quantumdex.io/auction/adapter')
- expect(bidRequests.method).to.equal('POST')
- expect(bidRequests.bidderRequests).to.eql(bidRequest);
- })
-
- it('should return a properly formatted request with GDPR applies set to true', function () {
- const bidRequests = spec.buildRequests(bidRequest, bidderRequests)
- expect(bidRequests.url).to.equal('https://useast.quantumdex.io/auction/adapter')
- expect(bidRequests.method).to.equal('POST')
- expect(bidRequests.data.gdpr.gdprApplies).to.equal('true')
- expect(bidRequests.data.gdpr.consentString).to.equal('BOJ/P2HOJ/P2HABABMAAAAAZ+A==')
- })
-
- it('should return a properly formatted request with GDPR applies set to false', function () {
- bidderRequests.gdprConsent.gdprApplies = false;
- const bidRequests = spec.buildRequests(bidRequest, bidderRequests)
- expect(bidRequests.url).to.equal('https://useast.quantumdex.io/auction/adapter')
- expect(bidRequests.method).to.equal('POST')
- expect(bidRequests.data.gdpr.gdprApplies).to.equal('false')
- expect(bidRequests.data.gdpr.consentString).to.equal('BOJ/P2HOJ/P2HABABMAAAAAZ+A==')
- })
- it('should return a properly formatted request with GDPR applies set to false with no consent_string param', function () {
- let bidderRequests = {
- 'gdprConsent': {
- 'consentString': undefined,
- 'vendorData': {},
- 'gdprApplies': false
- },
- 'refererInfo': {
- 'numIframes': 0,
- 'reachedTop': true,
- 'referer': 'https://example.com',
- 'stack': ['https://example.com']
- }
- };
- const bidRequests = spec.buildRequests(bidRequest, bidderRequests)
- expect(bidRequests.url).to.equal('https://useast.quantumdex.io/auction/adapter')
- expect(bidRequests.method).to.equal('POST')
- expect(bidRequests.data.gdpr.gdprApplies).to.equal('false')
- expect(bidRequests.data.gdpr).to.not.include.keys('consentString')
- })
- it('should return a properly formatted request with GDPR applies set to true with no consentString param', function () {
- let bidderRequests = {
- 'gdprConsent': {
- 'consentString': undefined,
- 'vendorData': {},
- 'gdprApplies': true
- },
- 'refererInfo': {
- 'numIframes': 0,
- 'reachedTop': true,
- 'referer': 'https://example.com',
- 'stack': ['https://example.com']
- }
- };
- const bidRequests = spec.buildRequests(bidRequest, bidderRequests)
- expect(bidRequests.url).to.equal('https://useast.quantumdex.io/auction/adapter')
- expect(bidRequests.method).to.equal('POST')
- expect(bidRequests.data.gdpr.gdprApplies).to.equal('true')
- expect(bidRequests.data.gdpr).to.not.include.keys('consentString')
- })
- it('should return a properly formatted request with schain defined', function () {
- const bidRequests = spec.buildRequests(bidRequest, bidderRequests);
- expect(JSON.parse(bidRequests.data.schain)).to.deep.equal(bidRequest[0].schain)
- });
- it('should return a properly formatted request with us_privacy included', function () {
- const bidRequests = spec.buildRequests(bidRequest, bidderRequests);
- expect(bidRequests.data.us_privacy).to.equal('someCCPAString');
- });
- });
-
- describe('.interpretResponse', function () {
- const bidRequests = {
- 'method': 'POST',
- 'url': 'https://useast.quantumdex.io/auction/adapter',
- 'withCredentials': true,
- 'data': {
- 'device': {
- 'ua': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36',
- 'height': 937,
- 'width': 1920,
- 'dnt': 0,
- 'language': 'vi'
- },
- 'site': {
- 'id': '343',
- 'page': 'https://www.example.com/tutorial',
- 'referrer': '',
- 'hostname': 'www.example.com'
- }
- },
- 'bidderRequests': [
- {
- 'bidder': 'valueimpression',
- 'params': {
- 'siteId': '343'
- },
- 'crumbs': {
- 'pubcid': 'c2b2ba08-9954-4850-8ee5-2bf4a2b35eff'
- },
- 'mediaTypes': {
- 'banner': {
- 'sizes': [[160, 600], [120, 600]]
- }
- },
- 'adUnitCode': 'vi_3431035_1',
- 'transactionId': '994d8404-4a28-4c43-98d8-a38dbb061910',
- 'sizes': [[160, 600], [120, 600]],
- 'bidId': '3000aa31c41a29c21',
- 'bidderRequestId': '299926b3d3628cdd7',
- 'auctionId': '22445943-a0aa-4c63-a413-4deb64fcff1c',
- 'src': 'client',
- 'bidRequestsCount': 41,
- 'bidderRequestsCount': 41,
- 'bidderWinsCount': 0,
- 'schain': {
- 'ver': '1.0',
- 'complete': 1,
- 'nodes': [
- {
- 'asi': 'freegames66.com',
- 'sid': '343',
- 'hp': 1
- }
- ]
- }
- },
- {
- 'bidder': 'valueimpression',
- 'params': {
- 'siteId': '343'
- },
- 'crumbs': {
- 'pubcid': 'c2b2ba08-9954-4850-8ee5-2bf4a2b35eff'
- },
- 'mediaTypes': {
- 'banner': {
- 'sizes': [[300, 250], [250, 250], [200, 200], [180, 150]]
- }
- },
- 'adUnitCode': 'vi_3431033_1',
- 'transactionId': '800fe87e-bfec-43a5-ace0-c4e2373ff4b5',
- 'sizes': [[300, 250], [250, 250], [200, 200], [180, 150]],
- 'bidId': '30024615be22ef66a',
- 'bidderRequestId': '299926b3d3628cdd7',
- 'auctionId': '22445943-a0aa-4c63-a413-4deb64fcff1c',
- 'src': 'client',
- 'bidRequestsCount': 41,
- 'bidderRequestsCount': 41,
- 'bidderWinsCount': 0,
- 'schain': {
- 'ver': '1.0',
- 'complete': 1,
- 'nodes': [
- {
- 'asi': 'freegames66.com',
- 'sid': '343',
- 'hp': 1
- }
- ]
- }
- },
- {
- 'bidder': 'valueimpression',
- 'params': {
- 'siteId': '343'
- },
- 'crumbs': {
- 'pubcid': 'c2b2ba08-9954-4850-8ee5-2bf4a2b35eff'
- },
- 'mediaTypes': {
- 'video': {
- 'playerSize': [[640, 480]],
- 'context': 'instream',
- 'mimes': [
- 'video/mp4',
- 'video/x-flv',
- 'video/x-ms-wmv',
- 'application/vnd.apple.mpegurl',
- 'application/x-mpegurl',
- 'video/3gpp',
- 'video/mpeg',
- 'video/ogg',
- 'video/quicktime',
- 'video/webm',
- 'video/x-m4v',
- 'video/ms-asf',
- 'video/x-msvideo'
- ],
- 'protocols': [1, 2, 3, 4, 5, 6],
- 'playbackmethod': [6],
- 'maxduration': 120,
- 'linearity': 1,
- 'api': [2]
- }
- },
- 'adUnitCode': 'vi_3431909',
- 'transactionId': '33d83d87-43cc-499b-aabe-5c22eb6acfbb',
- 'sizes': [[640, 480]],
- 'bidId': '1854b40107d6745c',
- 'bidderRequestId': '1840763b6bda185d',
- 'auctionId': 'df495de0-5d42-471f-a501-73bcd7254b80',
- 'src': 'client',
- 'bidRequestsCount': 1,
- 'bidderRequestsCount': 1,
- 'bidderWinsCount': 0,
- 'schain': {
- 'ver': '1.0',
- 'complete': 1,
- 'nodes': [
- {
- 'asi': 'freegames66.com',
- 'sid': '343',
- 'hp': 1
- }
- ]
- }
- }
- ]
- };
-
- let serverResponse = {
- 'body': {
- 'bids': [
- {
- 'requestId': '3000aa31c41a29c21',
- 'cpm': 1.07,
- 'width': 160,
- 'height': 600,
- 'ad': `
Valueimpression AD
`,
- 'ttl': 500,
- 'creativeId': '1234abcd',
- 'netRevenue': true,
- 'currency': 'USD',
- 'dealId': 'valueimpression',
- 'mediaType': 'banner'
- },
- {
- 'requestId': '30024615be22ef66a',
- 'cpm': 1,
- 'width': 300,
- 'height': 250,
- 'ad': `
Valueimpression AD
`,
- 'ttl': 500,
- 'creativeId': '1234abcd',
- 'netRevenue': true,
- 'currency': 'USD',
- 'dealId': 'valueimpression',
- 'mediaType': 'banner'
- },
- {
- 'requestId': '1854b40107d6745c',
- 'cpm': 1.25,
- 'width': 300,
- 'height': 250,
- 'vastXml': '
valueimpression',
- 'ttl': 500,
- 'creativeId': '30292e432662bd5f86d90774b944b038',
- 'netRevenue': true,
- 'currency': 'USD',
- 'dealId': 'valueimpression',
- 'mediaType': 'video'
- }
- ],
- 'pixel': [{
- 'url': 'https://example.com/pixel.png',
- 'type': 'image'
- }]
- }
- };
-
- let prebidResponse = [
- {
- 'requestId': '3000aa31c41a29c21',
- 'cpm': 1.07,
- 'width': 160,
- 'height': 600,
- 'ad': `
Valueimpression AD
`,
- 'ttl': 500,
- 'creativeId': '1234abcd',
- 'netRevenue': true,
- 'currency': 'USD',
- 'dealId': 'valueimpression',
- 'mediaType': 'banner'
- },
- {
- 'requestId': '30024615be22ef66a',
- 'cpm': 1,
- 'width': 300,
- 'height': 250,
- 'ad': `
Valueimpression AD
`,
- 'ttl': 500,
- 'creativeId': '1234abcd',
- 'netRevenue': true,
- 'currency': 'USD',
- 'dealId': 'valueimpression',
- 'mediaType': 'banner'
- },
- {
- 'requestId': '1854b40107d6745c',
- 'cpm': 1.25,
- 'width': 300,
- 'height': 250,
- 'vastXml': '
valueimpression',
- 'ttl': 500,
- 'creativeId': '30292e432662bd5f86d90774b944b038',
- 'netRevenue': true,
- 'currency': 'USD',
- 'dealId': 'valueimpression',
- 'mediaType': 'video'
- }
- ];
-
- it('should map bidResponse to prebidResponse', function () {
- const response = spec.interpretResponse(serverResponse, bidRequests);
- response.forEach((resp, i) => {
- expect(resp.requestId).to.equal(prebidResponse[i].requestId);
- expect(resp.cpm).to.equal(prebidResponse[i].cpm);
- expect(resp.width).to.equal(prebidResponse[i].width);
- expect(resp.height).to.equal(prebidResponse[i].height);
- expect(resp.ttl).to.equal(prebidResponse[i].ttl);
- expect(resp.creativeId).to.equal(prebidResponse[i].creativeId);
- expect(resp.netRevenue).to.equal(prebidResponse[i].netRevenue);
- expect(resp.currency).to.equal(prebidResponse[i].currency);
- expect(resp.dealId).to.equal(prebidResponse[i].dealId);
- if (resp.mediaType === 'video') {
- expect(resp.vastXml.indexOf('valueimpression')).to.be.greaterThan(0);
- }
- if (resp.mediaType === 'banner') {
- expect(resp.ad.indexOf('Valueimpression AD')).to.be.greaterThan(0);
- }
- });
- });
- });
-
- describe('.getUserSyncs', function () {
- let bidResponse = [{
- 'body': {
- 'pixel': [{
- 'url': 'https://pixel-test',
- 'type': 'image'
- }]
- }
- }];
-
- it('should return one sync pixel', function () {
- expect(spec.getUserSyncs({ pixelEnabled: true }, bidResponse)).to.deep.equal([{
- type: 'image',
- url: 'https://pixel-test'
- }]);
- });
- it('should return an empty array when sync is enabled but there are no bidResponses', function () {
- expect(spec.getUserSyncs({ pixelEnabled: true }, [])).to.have.length(0);
- });
-
- it('should return an empty array when sync is enabled but no sync pixel returned', function () {
- const pixel = Object.assign({}, bidResponse);
- delete pixel[0].body.pixel;
- expect(spec.getUserSyncs({ pixelEnabled: true }, bidResponse)).to.have.length(0);
- });
-
- it('should return an empty array', function () {
- expect(spec.getUserSyncs({ pixelEnabled: false }, bidResponse)).to.have.length(0);
- expect(spec.getUserSyncs({ pixelEnabled: true }, [])).to.have.length(0);
- });
- });
-});
diff --git a/test/spec/modules/vidazooBidAdapter_spec.js b/test/spec/modules/vidazooBidAdapter_spec.js
index fb9c540708b..b8ab83a95ae 100644
--- a/test/spec/modules/vidazooBidAdapter_spec.js
+++ b/test/spec/modules/vidazooBidAdapter_spec.js
@@ -1,10 +1,15 @@
import { expect } from 'chai';
-import { spec as adapter, URL, SUPPORTED_ID_SYSTEMS } from 'modules/vidazooBidAdapter.js';
+import { spec as adapter, SUPPORTED_ID_SYSTEMS, createDomain } from 'modules/vidazooBidAdapter.js';
import * as utils from 'src/utils.js';
+import { version } from 'package.json';
+
+const SUB_DOMAIN = 'openrtb';
const BID = {
'bidId': '2d52001cabd527',
+ 'adUnitCode': 'div-gpt-ad-12345-0',
'params': {
+ 'subDomain': SUB_DOMAIN,
'cId': '59db6b3b4ffaa70004f45cdc',
'pId': '59ac17c192832d0011283fe3',
'bidFloor': 0.1,
@@ -128,7 +133,7 @@ describe('VidazooBidAdapter', function () {
expect(requests).to.have.length(1);
expect(requests[0]).to.deep.equal({
method: 'POST',
- url: `${URL}/prebid/multi/59db6b3b4ffaa70004f45cdc`,
+ url: `${createDomain(SUB_DOMAIN)}/prebid/multi/59db6b3b4ffaa70004f45cdc`,
data: {
gdprConsent: 'consent_string',
gdpr: 1,
@@ -138,8 +143,11 @@ describe('VidazooBidAdapter', function () {
cb: 1000,
bidFloor: 0.1,
bidId: '2d52001cabd527',
+ adUnitCode: 'div-gpt-ad-12345-0',
publisherId: '59ac17c192832d0011283fe3',
dealId: 1,
+ bidderVersion: adapter.version,
+ prebidVersion: version,
res: `${window.top.screen.width}x${window.top.screen.height}`,
'ext.param1': 'loremipsum',
'ext.param2': 'dolorsitamet',