Skip to content

Commit a2fc0b5

Browse files
Bill Newmanvladis-teqblazeAiholkinMykhailo Yaremchuk
authored
Colossus Bid Adapter: update buildRequests (prebid#8272)
* add video&native traffic colossus ssp * Native obj validation * Native obj validation #2 * Added size field in requests * fixed test * fix merge conflicts * move to 3.0 * move to 3.0 * fix IE11 new URL issue * fix IE11 new URL issue * fix IE11 new URL issue * https for 3.0 * add https test * add ccp and schain features * fix test * sync with upstream, fix conflicts * Update colossussspBidAdapter.js remove commented code * Update colossussspBidAdapter.js lint fix * identity extensions * identity extensions * fix * fix * fix * fix * fix * add tests for user ids * fix * fix * fix * fix * fix * fix * fix * add gdpr support * add gdpr support * id5id support * Update colossussspBidAdapter.js add bidfloor parameter * Update colossussspBidAdapter.js check bidfloor * Update colossussspBidAdapter.js * Update colossussspBidAdapter.js * Update colossussspBidAdapter.js * Update colossussspBidAdapter_spec.js * use floor module * Revert "use floor module" This reverts commit f0c5c24. * use floor module * update to 5v * fix * add uid2 and bidFloor support * fix * add pbadslot support * fix conflicts * add onBidWon * refactor * add test for onBidWon() * fix * add group_id * Trigger circleci * fix * update user sync * fix window.location * fix test * updates * fix conflict * fix * updates Co-authored-by: Vladislav Isaiko <[email protected]> Co-authored-by: Aiholkin <[email protected]> Co-authored-by: Mykhailo Yaremchuk <[email protected]>
1 parent 2c0518f commit a2fc0b5

File tree

2 files changed

+102
-4
lines changed

2 files changed

+102
-4
lines changed

modules/colossussspBidAdapter.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ export const spec = {
112112
placementId: bid.params.placement_id,
113113
groupId: bid.params.group_id,
114114
bidId: bid.bidId,
115-
sizes: bid.mediaTypes[traff].sizes,
116115
traffic: traff,
117116
eids: [],
118117
floor: {}
@@ -146,7 +145,12 @@ export const spec = {
146145
rtiPartner: 'TDID'
147146
});
148147
}
148+
if (traff === BANNER) {
149+
placement.sizes = bid.mediaTypes[BANNER].sizes
150+
}
151+
149152
if (traff === VIDEO) {
153+
placement.sizes = bid.mediaTypes[VIDEO].playerSize;
150154
placement.playerSize = bid.mediaTypes[VIDEO].playerSize;
151155
placement.minduration = bid.mediaTypes[VIDEO].minduration;
152156
placement.maxduration = bid.mediaTypes[VIDEO].maxduration;

test/spec/modules/colossussspBidAdapter_spec.js

+97-3
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ describe('ColossussspAdapter', function () {
4848
auctionStart: 1472239426000,
4949
timeout: 5000,
5050
uspConsent: '1YN-',
51+
gdprConsent: {
52+
consentString: 'xxx',
53+
gdprApplies: 1
54+
},
5155
refererInfo: {
5256
referer: 'http://www.example.com',
5357
reachedTop: true,
@@ -87,7 +91,7 @@ describe('ColossussspAdapter', function () {
8791
it('Returns valid data if array of bids is valid', function () {
8892
let data = serverRequest.data;
8993
expect(data).to.be.an('object');
90-
expect(data).to.have.all.keys('deviceWidth', 'deviceHeight', 'language', 'secure', 'host', 'page', 'placements', 'ccpa');
94+
expect(data).to.have.all.keys('deviceWidth', 'deviceHeight', 'language', 'secure', 'host', 'page', 'placements', 'ccpa', 'gdpr_consent', 'gdpr_require');
9195
expect(data.deviceWidth).to.be.a('number');
9296
expect(data.deviceHeight).to.be.a('number');
9397
expect(data.language).to.be.a('string');
@@ -108,6 +112,53 @@ describe('ColossussspAdapter', function () {
108112
expect(placement.gpid).to.be.an('string');
109113
}
110114
});
115+
116+
it('Returns valid video data if array of bids is valid', function () {
117+
const videoBid = {
118+
...bid,
119+
params: {
120+
placement_id: 0,
121+
traffic: 'video',
122+
},
123+
mediaTypes: {
124+
video: {
125+
playerSize: [[300, 300]],
126+
minduration: 5,
127+
maxduration: 60
128+
}
129+
}
130+
}
131+
let serverRequest = spec.buildRequests([videoBid], bidderRequest);
132+
133+
let data = serverRequest.data;
134+
expect(data).to.be.an('object');
135+
expect(data).to.have.all.keys('deviceWidth', 'deviceHeight', 'language', 'secure', 'host', 'page', 'placements', 'ccpa', 'gdpr_consent', 'gdpr_require');
136+
expect(data.deviceWidth).to.be.a('number');
137+
expect(data.deviceHeight).to.be.a('number');
138+
expect(data.language).to.be.a('string');
139+
expect(data.secure).to.be.within(0, 1);
140+
expect(data.host).to.be.a('string');
141+
expect(data.page).to.be.a('string');
142+
let placements = data['placements'];
143+
for (let i = 0; i < placements.length; i++) {
144+
let placement = placements[i];
145+
expect(placement).to.have.all.keys('placementId', 'groupId', 'eids', 'bidId', 'traffic', 'schain', 'floor', 'gpid', 'sizes',
146+
'playerSize', 'minduration', 'maxduration', 'mimes', 'protocols', 'startdelay', 'placement', 'skip', 'skipafter',
147+
'minbitrate', 'maxbitrate', 'delivery', 'playbackmethod', 'api', 'linearity'
148+
);
149+
expect(placement.schain).to.be.an('object')
150+
expect(placement.placementId).to.be.a('number');
151+
expect(placement.bidId).to.be.a('string');
152+
expect(placement.traffic).to.be.a('string');
153+
expect(placement.floor).to.be.an('object');
154+
expect(placement.gpid).to.be.an('string');
155+
expect(placement.sizes).to.be.an('array');
156+
expect(placement.playerSize).to.be.an('array');
157+
expect(placement.minduration).to.be.an('number');
158+
expect(placement.maxduration).to.be.an('number');
159+
}
160+
});
161+
111162
it('Returns empty data if no valid requests are passed', function () {
112163
serverRequest = spec.buildRequests([], bidderRequest);
113164
let data = serverRequest.data;
@@ -187,6 +238,49 @@ describe('ColossussspAdapter', function () {
187238
expect(serverResponses).to.be.an('array').that.is.empty;
188239
});
189240
});
241+
242+
let videoResObject = {
243+
body: [{
244+
requestId: '123',
245+
mediaType: 'video',
246+
cpm: 0.3,
247+
width: 320,
248+
height: 50,
249+
vastUrl: '<XML>',
250+
ttl: 1000,
251+
creativeId: '123asd',
252+
netRevenue: true,
253+
currency: 'USD',
254+
meta: {
255+
advertiserDomains: ['google.com'],
256+
advertiserId: 1234
257+
}
258+
}]
259+
};
260+
let videoServerResponses = spec.interpretResponse(videoResObject);
261+
it('Returns an array of valid server video responses if response object is valid', function () {
262+
expect(videoServerResponses).to.be.an('array').that.is.not.empty;
263+
for (let i = 0; i < videoServerResponses.length; i++) {
264+
let dataItem = videoServerResponses[i];
265+
expect(dataItem).to.have.all.keys('requestId', 'cpm', 'width', 'height', 'vastUrl', 'ttl', 'creativeId',
266+
'netRevenue', 'currency', 'mediaType', 'meta');
267+
expect(dataItem.requestId).to.be.a('string');
268+
expect(dataItem.cpm).to.be.a('number');
269+
expect(dataItem.width).to.be.a('number');
270+
expect(dataItem.height).to.be.a('number');
271+
expect(dataItem.vastUrl).to.be.a('string');
272+
expect(dataItem.ttl).to.be.a('number');
273+
expect(dataItem.creativeId).to.be.a('string');
274+
expect(dataItem.netRevenue).to.be.a('boolean');
275+
expect(dataItem.currency).to.be.a('string');
276+
expect(dataItem.mediaType).to.be.a('string');
277+
expect(dataItem.meta).to.be.an('object').that.has.any.key('advertiserDomains');
278+
}
279+
it('Returns an empty array if invalid response is passed', function () {
280+
videoServerResponses = spec.interpretResponse('invalid_response');
281+
expect(videoServerResponses).to.be.an('array').that.is.empty;
282+
});
283+
});
190284
});
191285

192286
describe('onBidWon', function () {
@@ -199,13 +293,13 @@ describe('ColossussspAdapter', function () {
199293
})
200294

201295
describe('getUserSyncs', function () {
202-
let userSync = spec.getUserSyncs({}, {}, {}, {});
296+
let userSync = spec.getUserSyncs({}, {}, { consentString: 'xxx', gdprApplies: 1 }, { consentString: '1YN-' });
203297
it('Returns valid URL and type', function () {
204298
expect(userSync).to.be.an('array').with.lengthOf(1);
205299
expect(userSync[0].type).to.exist;
206300
expect(userSync[0].url).to.exist;
207301
expect(userSync[0].type).to.be.equal('hms.gif');
208-
expect(userSync[0].url).to.be.equal('https://sync.colossusssp.com/hms.gif?pbjs=1&coppa=0');
302+
expect(userSync[0].url).to.be.equal('https://sync.colossusssp.com/hms.gif?pbjs=1&gdpr=0&gdpr_consent=xxx&ccpa_consent=1YN-&coppa=0');
209303
});
210304
});
211305
});

0 commit comments

Comments
 (0)