prebid.js 5.18.0 → 5.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browsers.json +1 -0
- package/integrationExamples/gpt/akamaidap_segments_example.html +132 -0
- package/modules/.submodules.json +1 -0
- package/modules/adfBidAdapter.js +21 -16
- package/modules/adtelligentBidAdapter.js +2 -1
- package/modules/adxcgBidAdapter.js +311 -359
- package/modules/airgridRtdProvider.js +1 -1
- package/modules/akamaiDapRtdProvider.js +474 -0
- package/modules/akamaiDapRtdProvider.md +47 -0
- package/modules/appnexusBidAdapter.js +9 -3
- package/modules/atsAnalyticsAdapter.js +67 -46
- package/modules/atsAnalyticsAdapter.md +1 -0
- package/modules/betweenBidAdapter.js +20 -3
- package/modules/browsiRtdProvider.js +106 -18
- package/modules/cleanioRtdProvider.js +192 -0
- package/modules/cleanioRtdProvider.md +59 -0
- package/modules/codefuelBidAdapter.js +183 -0
- package/modules/codefuelBidAdapter.md +111 -0
- package/modules/connectIdSystem.js +104 -0
- package/modules/connectIdSystem.md +33 -0
- package/modules/deepintentBidAdapter.js +106 -9
- package/modules/deepintentBidAdapter.md +36 -1
- package/modules/deltaprojectsBidAdapter.js +252 -0
- package/modules/deltaprojectsBidAdapter.md +32 -0
- package/modules/engageyaBidAdapter.js +157 -0
- package/modules/gridBidAdapter.js +1 -0
- package/modules/gumgumBidAdapter.js +8 -0
- package/modules/inskinBidAdapter.js +7 -3
- package/modules/ipromBidAdapter.js +79 -0
- package/modules/ixBidAdapter.js +8 -1
- package/modules/jixieBidAdapter.js +8 -2
- package/modules/justpremiumBidAdapter.js +6 -1
- package/modules/kinessoIdSystem.js +1 -1
- package/modules/limelightDigitalBidAdapter.js +22 -2
- package/modules/livewrappedAnalyticsAdapter.js +49 -1
- package/modules/multibid/index.js +3 -3
- package/modules/nativoBidAdapter.js +5 -1
- package/modules/nextMillenniumBidAdapter.js +12 -3
- package/modules/oguryBidAdapter.js +14 -1
- package/modules/openxBidAdapter.js +34 -22
- package/modules/operaadsBidAdapter.js +21 -1
- package/modules/otmBidAdapter.js +146 -0
- package/modules/otmBidAdapter.md +27 -26
- package/modules/outbrainBidAdapter.js +5 -0
- package/modules/playwireBidAdapter.md +61 -0
- package/modules/publinkIdSystem.js +11 -6
- package/modules/rtdModule/index.js +2 -2
- package/modules/sonobiBidAdapter.js +7 -0
- package/modules/sortableBidAdapter.js +1 -0
- package/modules/teadsBidAdapter.js +3 -0
- package/modules/tripleliftBidAdapter.js +22 -5
- package/modules/trustxBidAdapter.js +8 -6
- package/modules/undertoneBidAdapter.js +9 -5
- package/modules/undertoneBidAdapter.md +5 -1
- package/modules/userId/eids.js +18 -0
- package/modules/userId/eids.md +7 -0
- package/modules/userId/userId.md +12 -0
- package/modules/ventesBidAdapter.js +370 -0
- package/modules/ventesBidAdapter.md +94 -0
- package/modules/videobyteBidAdapter.js +13 -6
- package/modules/videobyteBidAdapter.md +49 -0
- package/modules/yahoosspBidAdapter.js +6 -6
- package/modules/yieldmoSyntheticInventoryModule.js +46 -0
- package/modules/yieldmoSyntheticInventoryModule.md +68 -0
- package/package.json +1 -1
- package/src/adapterManager.js +5 -0
- package/src/adapters/bidderFactory.js +4 -3
- package/src/auction.js +11 -11
- package/src/constants.json +1 -0
- package/src/secureCreatives.js +6 -7
- package/src/targeting.js +11 -9
- package/test/spec/modules/adfBidAdapter_spec.js +83 -29
- package/test/spec/modules/adtelligentBidAdapter_spec.js +1 -0
- package/test/spec/modules/adxcgBidAdapter_spec.js +827 -571
- package/test/spec/modules/akamaiDapRtdProvider_spec.js +246 -0
- package/test/spec/modules/appnexusBidAdapter_spec.js +16 -1
- package/test/spec/modules/atsAnalyticsAdapter_spec.js +42 -9
- package/test/spec/modules/betweenBidAdapter_spec.js +41 -0
- package/test/spec/modules/browsiRtdProvider_spec.js +62 -7
- package/test/spec/modules/cleanioRtdProvider_spec.js +188 -0
- package/test/spec/modules/codefuelBidAdapter_spec.js +316 -0
- package/test/spec/modules/connectIdSystem_spec.js +189 -0
- package/test/spec/modules/deepintentBidAdapter_spec.js +153 -3
- package/test/spec/modules/deltaprojectsBidAdapter_spec.js +399 -0
- package/test/spec/modules/engageyaBidAdapter_spec.js +286 -0
- package/test/spec/modules/eplanningBidAdapter_spec.js +8 -8
- package/test/spec/modules/gumgumBidAdapter_spec.js +5 -1
- package/test/spec/modules/ipromBidAdapter_spec.js +195 -0
- package/test/spec/modules/ixBidAdapter_spec.js +13 -3
- package/test/spec/modules/jixieBidAdapter_spec.js +13 -11
- package/test/spec/modules/justpremiumBidAdapter_spec.js +9 -2
- package/test/spec/modules/limelightDigitalBidAdapter_spec.js +155 -1
- package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +52 -7
- package/test/spec/modules/multibid_spec.js +31 -31
- package/test/spec/modules/nextMillenniumBidAdapter_spec.js +13 -1
- package/test/spec/modules/oguryBidAdapter_spec.js +53 -12
- package/test/spec/modules/openxBidAdapter_spec.js +85 -13
- package/test/spec/modules/operaadsBidAdapter_spec.js +38 -6
- package/test/spec/modules/otmBidAdapter_spec.js +67 -0
- package/test/spec/modules/outbrainBidAdapter_spec.js +18 -0
- package/test/spec/modules/publinkIdSystem_spec.js +6 -6
- package/test/spec/modules/sonobiBidAdapter_spec.js +34 -1
- package/test/spec/modules/sortableBidAdapter_spec.js +11 -0
- package/test/spec/modules/teadsBidAdapter_spec.js +132 -0
- package/test/spec/modules/tripleliftBidAdapter_spec.js +128 -0
- package/test/spec/modules/trustxBidAdapter_spec.js +3 -3
- package/test/spec/modules/undertoneBidAdapter_spec.js +52 -0
- package/test/spec/modules/ventesBidAdapter_spec.js +845 -0
- package/test/spec/modules/videobyteBidAdapter_spec.js +2 -2
- package/test/spec/modules/yieldmoSyntheticInventoryModule_spec.js +89 -0
- package/test/spec/unit/core/adapterManager_spec.js +37 -2
- package/test/spec/unit/core/bidderFactory_spec.js +61 -1
- package/test/spec/unit/pbjs_api_spec.js +37 -2
- package/test/spec/unit/secureCreatives_spec.js +54 -25
|
@@ -3,8 +3,8 @@ import {spec} from 'modules/deepintentBidAdapter.js';
|
|
|
3
3
|
import * as utils from '../../../src/utils.js';
|
|
4
4
|
|
|
5
5
|
describe('Deepintent adapter', function () {
|
|
6
|
-
let request;
|
|
7
|
-
let bannerResponse;
|
|
6
|
+
let request, videoBidRequests;
|
|
7
|
+
let bannerResponse, videoBidResponse, invalidResponse;
|
|
8
8
|
|
|
9
9
|
beforeEach(function () {
|
|
10
10
|
request = [
|
|
@@ -32,6 +32,38 @@ describe('Deepintent adapter', function () {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
];
|
|
35
|
+
videoBidRequests =
|
|
36
|
+
[
|
|
37
|
+
{
|
|
38
|
+
code: 'video1',
|
|
39
|
+
mediaTypes: {
|
|
40
|
+
video: {
|
|
41
|
+
playerSize: [640, 480],
|
|
42
|
+
context: 'instream'
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
bidder: 'deepintent',
|
|
46
|
+
bidId: '22bddb28db77d',
|
|
47
|
+
params: {
|
|
48
|
+
tagId: '100013',
|
|
49
|
+
video: {
|
|
50
|
+
mimes: ['video/mp4', 'video/x-flv'],
|
|
51
|
+
skippable: true,
|
|
52
|
+
testwrongparam: 3,
|
|
53
|
+
testwrongparam1: 'wrong',
|
|
54
|
+
minduration: 5,
|
|
55
|
+
maxduration: 30,
|
|
56
|
+
startdelay: 5,
|
|
57
|
+
playbackmethod: [1, 3],
|
|
58
|
+
api: [1, 2],
|
|
59
|
+
protocols: [2, 3],
|
|
60
|
+
battr: [13, 14],
|
|
61
|
+
minbitrate: 10,
|
|
62
|
+
maxbitrate: 10
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
];
|
|
35
67
|
bannerResponse = {
|
|
36
68
|
'body': {
|
|
37
69
|
'id': '303e1fae-9677-41e2-9a92-15a23445363f',
|
|
@@ -53,7 +85,47 @@ describe('Deepintent adapter', function () {
|
|
|
53
85
|
}],
|
|
54
86
|
'bidid': '0b08b09f-aaa1-4c14-b1c8-7debb1a7c1cd'
|
|
55
87
|
}
|
|
56
|
-
}
|
|
88
|
+
};
|
|
89
|
+
invalidResponse = {
|
|
90
|
+
'body': {
|
|
91
|
+
'id': '303e1fae-9677-41e2-9a92-15a23445363f',
|
|
92
|
+
'seatbid': [{
|
|
93
|
+
'bid': [{
|
|
94
|
+
'id': '11447bb1-a266-470d-b0d7-8810f5b1b75f',
|
|
95
|
+
'impid': 'a7e92b9b-d9db-4de8-9c3f-f90737335445',
|
|
96
|
+
'price': 0.6,
|
|
97
|
+
'adid': '10001',
|
|
98
|
+
'adm': 'invalid response',
|
|
99
|
+
'adomain': ['deepintent.com'],
|
|
100
|
+
'cid': '103389',
|
|
101
|
+
'crid': '13665',
|
|
102
|
+
'w': 300,
|
|
103
|
+
'h': 250,
|
|
104
|
+
'dealId': 'dee_12312stdszzsx'
|
|
105
|
+
}],
|
|
106
|
+
'seat': '10000'
|
|
107
|
+
}],
|
|
108
|
+
'bidid': '0b08b09f-aaa1-4c14-b1c8-7debb1a7c1cd'
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
videoBidResponse = {
|
|
112
|
+
'body': {
|
|
113
|
+
'id': '93D3BAD6-E2E2-49FB-9D89-920B1761C865',
|
|
114
|
+
'seatbid': [{
|
|
115
|
+
'bid': [{
|
|
116
|
+
'id': '74858439-49D7-4169-BA5D-44A046315B2F',
|
|
117
|
+
'impid': '22bddb28db77d',
|
|
118
|
+
'price': 1.3,
|
|
119
|
+
'adm': '<VAST version="3.0"><Ad id="601364"><InLine><AdSystem>Acudeo Compatible</AdSystem><AdTitle>VAST 2.0 Instream Test 1</AdTitle><Description>VAST 2.0 Instream Test 1</Description><Impression><![CDATA[http://172.16.4.213/AdServer/AdDisplayTrackerServlet?operId=1&pubId=5890&siteId=47163&adId=1405268&adType=13&adServerId=243&kefact=70.000000&kaxefact=70.000000&kadNetFrequecy=0&kadwidth=0&kadheight=0&kadsizeid=97&kltstamp=1529929473&indirectAdId=0&adServerOptimizerId=2&ranreq=0.1&kpbmtpfact=100.000000&dcId=1&tldId=0&passback=0&svr=MADS1107&ekefact=Ad8wW91TCwCmdG0jlfjXn7Tyzh20hnTVx-m5DoNSep-RXGDr&ekaxefact=Ad8wWwRUCwAGir4Zzl1eF0bKiC-qrCV0D0yp_eE7YizB_BQk&ekpbmtpfact=Ad8wWxRUCwD7qgzwwPE2LnS5-Ou19uO5amJl1YT6-XVFvQ41&imprId=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&oid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&crID=creative-1_1_2&ucrid=160175026529250297&campaignId=17050&creativeId=0&pctr=0.000000&wDSPByrId=511&wDspId=6&wbId=0&wrId=0&wAdvID=3170&isRTB=1&rtbId=EBCA079F-8D7C-45B8-B733-92951F670AA1&pmZoneId=zone1&pageURL=www.yahoo.com&lpu=ae.com]]></Impression><Impression>https://dsptracker.com/{PSPM}</Impression><Error><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&er=[ERRORCODE]]]></Error><Error><![CDATA[https://Errortrack.com?p=1234&er=[ERRORCODE]]]></Error><Creatives><Creative AdID="601364"><Linear skipoffset="20%"><TrackingEvents><Tracking event="close"><![CDATA[https://mytracking.com/linear/close]]></Tracking><Tracking event="skip"><![CDATA[https://mytracking.com/linear/skip]]></Tracking><Tracking event="creativeView"><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&e=1]]></Tracking><Tracking event="start"><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&e=2]]></Tracking><Tracking event="midpoint"><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&e=3]]></Tracking><Tracking event="firstQuartile"><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&e=4]]></Tracking><Tracking event="thirdQuartile"><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&e=5]]></Tracking><Tracking event="complete"><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&e=6]]></Tracking></TrackingEvents><Duration>00:00:04</Duration><VideoClicks><ClickTracking><![CDATA[http://172.16.4.213/track?operId=7&p=5890&s=47163&a=1405268&wa=243&ts=1529929473&wc=17050&crId=creative-1_1_2&ucrid=160175026529250297&impid=48F73E1A-7F23-443D-A53C-30EE6BBF5F7F&advertiser_id=3170&ecpm=70.000000&e=99]]></ClickTracking><ClickThrough>https://www.deepintent.com</ClickThrough></VideoClicks><MediaFiles><MediaFile delivery="progressive" type="video/mp4" bitrate="500" width="400" height="300" scalable="true" maintainAspectRatio="true"><![CDATA[https://staging.deepintent.com:8443/video/Shashank/mediaFileHost/media/mp4-sample-2.mp4]]></MediaFile></MediaFiles></Linear></Creative></Creatives></InLine></Ad></VAST>',
|
|
120
|
+
'h': 250,
|
|
121
|
+
'w': 300,
|
|
122
|
+
'ext': {
|
|
123
|
+
'deal_channel': 6
|
|
124
|
+
}
|
|
125
|
+
}]
|
|
126
|
+
}]
|
|
127
|
+
}
|
|
128
|
+
};
|
|
57
129
|
});
|
|
58
130
|
|
|
59
131
|
describe('validations', function () {
|
|
@@ -88,6 +160,45 @@ describe('Deepintent adapter', function () {
|
|
|
88
160
|
isValid = spec.isBidRequestValid(bid);
|
|
89
161
|
expect(isValid).to.equals(false);
|
|
90
162
|
});
|
|
163
|
+
it('should check for context if video is present', function() {
|
|
164
|
+
let bid = {
|
|
165
|
+
bidder: 'deepintent',
|
|
166
|
+
params: {
|
|
167
|
+
tagId: '12345',
|
|
168
|
+
video: {
|
|
169
|
+
mimes: ['video/mp4', 'video/x-flv'],
|
|
170
|
+
skippable: true,
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
mediaTypes: {
|
|
174
|
+
video: {
|
|
175
|
+
playerSize: [640, 480],
|
|
176
|
+
context: 'instream'
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
isValid = spec.isBidRequestValid(bid);
|
|
181
|
+
expect(isValid).to.equal(true);
|
|
182
|
+
});
|
|
183
|
+
it('should error out if context is not present and is Video', function() {
|
|
184
|
+
let bid = {
|
|
185
|
+
bidder: 'deepintent',
|
|
186
|
+
params: {
|
|
187
|
+
tagId: '12345',
|
|
188
|
+
video: {
|
|
189
|
+
mimes: ['video/mp4', 'video/x-flv'],
|
|
190
|
+
skippable: true,
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
mediaTypes: {
|
|
194
|
+
video: {
|
|
195
|
+
playerSize: [640, 480]
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
isValid = spec.isBidRequestValid(bid);
|
|
200
|
+
expect(isValid).to.equal(false);
|
|
201
|
+
})
|
|
91
202
|
});
|
|
92
203
|
describe('request check', function () {
|
|
93
204
|
it('unmutaable bid request check', function () {
|
|
@@ -179,6 +290,28 @@ describe('Deepintent adapter', function () {
|
|
|
179
290
|
expect(data2.regs).to.equal(undefined);
|
|
180
291
|
expect(data2.user.ext).to.equal(undefined);
|
|
181
292
|
});
|
|
293
|
+
it('bid request check: Video params check ', function() {
|
|
294
|
+
let bRequest = spec.buildRequests(videoBidRequests);
|
|
295
|
+
let data = JSON.parse(bRequest.data);
|
|
296
|
+
expect(data.imp[0].video).to.be.a('object');
|
|
297
|
+
expect(data.imp[0].video.minduration).to.be.a('number');
|
|
298
|
+
expect(data.imp[0].video.maxduration).to.be.a('number');
|
|
299
|
+
expect(data.imp[0].video.startdelay).to.be.a('number');
|
|
300
|
+
expect(data.imp[0].video.playbackmethod).to.be.an('array');
|
|
301
|
+
expect(data.imp[0].video.api).to.be.an('array');
|
|
302
|
+
expect(data.imp[0].video.protocols).to.be.an('array');
|
|
303
|
+
expect(data.imp[0].video.battr).to.be.an('array');
|
|
304
|
+
expect(data.imp[0].video.minbitrate).to.be.a('number');
|
|
305
|
+
expect(data.imp[0].video.maxbitrate).to.be.a('number');
|
|
306
|
+
expect(data.imp[0].video.w).to.be.a('number');
|
|
307
|
+
});
|
|
308
|
+
it('bid request param check : invalid video params', function() {
|
|
309
|
+
let bRequest = spec.buildRequests(videoBidRequests);
|
|
310
|
+
let data = JSON.parse(bRequest.data);
|
|
311
|
+
expect(data.imp[0].video).to.be.a('object');
|
|
312
|
+
expect(data.imp[0].video.testwrongparam).to.equal(undefined);
|
|
313
|
+
expect(data.imp[0].video.testwrongparam1).to.equal(undefined);
|
|
314
|
+
});
|
|
182
315
|
});
|
|
183
316
|
describe('user sync check', function () {
|
|
184
317
|
it('user sync url check', function () {
|
|
@@ -202,10 +335,27 @@ describe('Deepintent adapter', function () {
|
|
|
202
335
|
expect(bResponse[0].height).to.equal(bannerResponse.body.seatbid[0].bid[0].h);
|
|
203
336
|
expect(bResponse[0].currency).to.equal('USD');
|
|
204
337
|
expect(bResponse[0].netRevenue).to.equal(false);
|
|
338
|
+
expect(bResponse[0].mediaType).to.equal('banner');
|
|
205
339
|
expect(bResponse[0].meta.advertiserDomains).to.deep.equal(['deepintent.com']);
|
|
206
340
|
expect(bResponse[0].ttl).to.equal(300);
|
|
207
341
|
expect(bResponse[0].creativeId).to.equal(bannerResponse.body.seatbid[0].bid[0].crid);
|
|
208
342
|
expect(bResponse[0].dealId).to.equal(bannerResponse.body.seatbid[0].bid[0].dealId);
|
|
209
343
|
});
|
|
344
|
+
it('bid response check: valid video bid response', function() {
|
|
345
|
+
let request = spec.buildRequests(videoBidRequests);
|
|
346
|
+
let response = spec.interpretResponse(videoBidResponse, request);
|
|
347
|
+
expect(response[0].mediaType).to.equal('video');
|
|
348
|
+
expect(response[0].vastXml).to.not.equal(undefined);
|
|
349
|
+
});
|
|
350
|
+
it('invalid bid response check ', function() {
|
|
351
|
+
let bRequest = spec.buildRequests(request);
|
|
352
|
+
let response = spec.interpretResponse(invalidResponse, bRequest);
|
|
353
|
+
expect(response[0].mediaType).to.equal(undefined);
|
|
354
|
+
});
|
|
355
|
+
it('invalid bid response check ', function() {
|
|
356
|
+
let bRequest = spec.buildRequests(videoBidRequests);
|
|
357
|
+
let response = spec.interpretResponse(invalidResponse, bRequest);
|
|
358
|
+
expect(response[0].mediaType).to.equal(undefined);
|
|
359
|
+
});
|
|
210
360
|
})
|
|
211
361
|
});
|
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import {
|
|
3
|
+
BIDDER_CODE,
|
|
4
|
+
BIDDER_ENDPOINT_URL,
|
|
5
|
+
spec, USERSYNC_URL,
|
|
6
|
+
getBidFloor
|
|
7
|
+
} from 'modules/deltaprojectsBidAdapter.js';
|
|
8
|
+
|
|
9
|
+
const BID_REQ_REFER = 'http://example.com/page?param=val';
|
|
10
|
+
|
|
11
|
+
describe('deltaprojectsBidAdapter', function() {
|
|
12
|
+
describe('isBidRequestValid', function () {
|
|
13
|
+
function makeBid() {
|
|
14
|
+
return {
|
|
15
|
+
bidder: BIDDER_CODE,
|
|
16
|
+
params: {
|
|
17
|
+
publisherId: '12345'
|
|
18
|
+
},
|
|
19
|
+
adUnitCode: 'adunit-code',
|
|
20
|
+
sizes: [
|
|
21
|
+
[300, 250],
|
|
22
|
+
],
|
|
23
|
+
bidId: '30b31c1838de1e',
|
|
24
|
+
bidderRequestId: '22edbae2733bf6',
|
|
25
|
+
auctionId: '1d1a030790a475',
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
it('should return true when bidder set correctly', function () {
|
|
30
|
+
expect(spec.isBidRequestValid(makeBid())).to.equal(true);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('should return false when bid request is null', function () {
|
|
34
|
+
expect(spec.isBidRequestValid(undefined)).to.equal(false);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('should return false when bidder not set correctly', function () {
|
|
38
|
+
let bid = makeBid();
|
|
39
|
+
delete bid.bidder;
|
|
40
|
+
expect(spec.isBidRequestValid(bid)).to.equal(false);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('should return false when publisher id is not set', function () {
|
|
44
|
+
let bid = makeBid();
|
|
45
|
+
delete bid.params.publisherId;
|
|
46
|
+
expect(spec.isBidRequestValid(bid)).to.equal(false);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
describe('buildRequests', function () {
|
|
51
|
+
const BIDREQ = {
|
|
52
|
+
bidder: BIDDER_CODE,
|
|
53
|
+
params: {
|
|
54
|
+
tagId: '403370',
|
|
55
|
+
siteId: 'example.com',
|
|
56
|
+
},
|
|
57
|
+
sizes: [
|
|
58
|
+
[300, 250],
|
|
59
|
+
],
|
|
60
|
+
bidId: '30b31c1838de1e',
|
|
61
|
+
bidderRequestId: '22edbae2733bf6',
|
|
62
|
+
auctionId: '1d1a030790a475',
|
|
63
|
+
}
|
|
64
|
+
const bidRequests = [BIDREQ];
|
|
65
|
+
const bannerRequest = spec.buildRequests(bidRequests, {refererInfo: { referer: BID_REQ_REFER }})[0];
|
|
66
|
+
const bannerRequestBody = bannerRequest.data;
|
|
67
|
+
|
|
68
|
+
it('send bid request with test tag if it is set in the param', function () {
|
|
69
|
+
const TEST_TAG = 1;
|
|
70
|
+
const bidRequest = Object.assign({}, BIDREQ, {
|
|
71
|
+
params: { ...BIDREQ.params, test: TEST_TAG },
|
|
72
|
+
});
|
|
73
|
+
const bidderRequest = { refererInfo: { referer: BID_REQ_REFER } };
|
|
74
|
+
const request = spec.buildRequests([bidRequest], bidderRequest)[0];
|
|
75
|
+
expect(request.data.test).to.equal(TEST_TAG);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('send bid request with correct timeout', function () {
|
|
79
|
+
const TMAX = 10;
|
|
80
|
+
const bidderRequest = { refererInfo: { referer: BID_REQ_REFER }, timeout: TMAX };
|
|
81
|
+
const request = spec.buildRequests(bidRequests, bidderRequest)[0];
|
|
82
|
+
expect(request.data.tmax).to.equal(TMAX);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('send bid request to the correct endpoint URL', function () {
|
|
86
|
+
expect(bannerRequest.url).to.equal(BIDDER_ENDPOINT_URL);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('sends bid request to our endpoint via POST', function () {
|
|
90
|
+
expect(bannerRequest.method).to.equal('POST');
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('sends screen dimensions', function () {
|
|
94
|
+
expect(bannerRequestBody.device.w).to.equal(screen.width);
|
|
95
|
+
expect(bannerRequestBody.device.h).to.equal(screen.height);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('includes the ad size in the bid request', function () {
|
|
99
|
+
expect(bannerRequestBody.imp[0].banner.format[0].w).to.equal(BIDREQ.sizes[0][0]);
|
|
100
|
+
expect(bannerRequestBody.imp[0].banner.format[0].h).to.equal(BIDREQ.sizes[0][1]);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('sets domain and href correctly', function () {
|
|
104
|
+
expect(bannerRequestBody.site.domain).to.equal(BIDREQ.params.siteId);
|
|
105
|
+
expect(bannerRequestBody.site.page).to.equal(BID_REQ_REFER);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
const gdprBidRequests = [{
|
|
109
|
+
bidder: BIDDER_CODE,
|
|
110
|
+
params: {
|
|
111
|
+
tagId: '403370',
|
|
112
|
+
siteId: 'example.com'
|
|
113
|
+
},
|
|
114
|
+
sizes: [
|
|
115
|
+
[300, 250]
|
|
116
|
+
],
|
|
117
|
+
bidId: '30b31c1838de1e',
|
|
118
|
+
bidderRequestId: '22edbae2733bf6',
|
|
119
|
+
auctionId: '1d1a030790a475'
|
|
120
|
+
}];
|
|
121
|
+
const consentString = 'BOJ/P2HOJ/P2HABABMAAAAAZ+A==';
|
|
122
|
+
|
|
123
|
+
const GDPR_REQ_REFERER = 'http://localhost:9876/'
|
|
124
|
+
function getGdprRequestBody(gdprApplies, consentString) {
|
|
125
|
+
const gdprRequest = spec.buildRequests(gdprBidRequests, {
|
|
126
|
+
gdprConsent: {
|
|
127
|
+
gdprApplies: gdprApplies,
|
|
128
|
+
consentString: consentString,
|
|
129
|
+
},
|
|
130
|
+
refererInfo: {
|
|
131
|
+
referer: GDPR_REQ_REFERER,
|
|
132
|
+
},
|
|
133
|
+
})[0];
|
|
134
|
+
return gdprRequest.data;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
it('should handle gdpr applies being present and true', function() {
|
|
138
|
+
const gdprRequestBody = getGdprRequestBody(true, consentString);
|
|
139
|
+
expect(gdprRequestBody.regs.ext.gdpr).to.equal(1);
|
|
140
|
+
expect(gdprRequestBody.user.ext.consent).to.equal(consentString);
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
it('should handle gdpr applies being present and false', function() {
|
|
144
|
+
const gdprRequestBody = getGdprRequestBody(false, consentString);
|
|
145
|
+
expect(gdprRequestBody.regs.ext.gdpr).to.equal(0);
|
|
146
|
+
expect(gdprRequestBody.user.ext.consent).to.equal(consentString);
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
it('should handle gdpr applies being undefined', function() {
|
|
150
|
+
const gdprRequestBody = getGdprRequestBody(undefined, consentString);
|
|
151
|
+
expect(gdprRequestBody.regs).to.deep.equal({ext: {}});
|
|
152
|
+
expect(gdprRequestBody.user.ext.consent).to.equal(consentString);
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
it('should handle gdpr consent being undefined', function() {
|
|
156
|
+
const gdprRequest = spec.buildRequests(gdprBidRequests, {refererInfo: { referer: GDPR_REQ_REFERER }})[0];
|
|
157
|
+
const gdprRequestBody = gdprRequest.data;
|
|
158
|
+
expect(gdprRequestBody.regs).to.deep.equal({ ext: {} });
|
|
159
|
+
expect(gdprRequestBody.user).to.deep.equal({ ext: {} });
|
|
160
|
+
})
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
describe('interpretResponse', function () {
|
|
164
|
+
const bidRequests = [
|
|
165
|
+
{
|
|
166
|
+
bidder: BIDDER_CODE,
|
|
167
|
+
params: {
|
|
168
|
+
tagId: '403370',
|
|
169
|
+
siteId: 'example.com',
|
|
170
|
+
currency: 'USD',
|
|
171
|
+
},
|
|
172
|
+
sizes: [
|
|
173
|
+
[300, 250],
|
|
174
|
+
],
|
|
175
|
+
bidId: '30b31c1838de1e',
|
|
176
|
+
bidderRequestId: '22edbae2733bf6',
|
|
177
|
+
auctionId: '1d1a030790a475',
|
|
178
|
+
},
|
|
179
|
+
];
|
|
180
|
+
const request = spec.buildRequests(bidRequests, {refererInfo: { referer: BID_REQ_REFER }})[0];
|
|
181
|
+
function makeResponse() {
|
|
182
|
+
return {
|
|
183
|
+
body: {
|
|
184
|
+
id: '5e5c23a5ba71e78',
|
|
185
|
+
seatbid: [
|
|
186
|
+
{
|
|
187
|
+
bid: [
|
|
188
|
+
{
|
|
189
|
+
id: '6vmb3isptf',
|
|
190
|
+
crid: 'deltaprojectscreative',
|
|
191
|
+
impid: '322add653672f68',
|
|
192
|
+
price: 1.22,
|
|
193
|
+
adm: '<!-- creative -->',
|
|
194
|
+
attr: [5],
|
|
195
|
+
h: 90,
|
|
196
|
+
nurl: 'http://nurl',
|
|
197
|
+
w: 728,
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
seat: 'MOCK'
|
|
201
|
+
}
|
|
202
|
+
],
|
|
203
|
+
bidid: '5e5c23a5ba71e78',
|
|
204
|
+
cur: 'USD'
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
const expectedBid = {
|
|
209
|
+
requestId: '322add653672f68',
|
|
210
|
+
cpm: 1.22,
|
|
211
|
+
width: 728,
|
|
212
|
+
height: 90,
|
|
213
|
+
creativeId: 'deltaprojectscreative',
|
|
214
|
+
dealId: null,
|
|
215
|
+
currency: 'USD',
|
|
216
|
+
netRevenue: true,
|
|
217
|
+
mediaType: 'banner',
|
|
218
|
+
ttl: 60,
|
|
219
|
+
ad: '<!-- creative --><div style="position:absolute;left:0px;top:0px;visibility:hidden;"><img src="http://nurl"></div>'
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
it('should get incorrect bid response if response body is missing', function () {
|
|
223
|
+
let response = makeResponse();
|
|
224
|
+
delete response.body;
|
|
225
|
+
let result = spec.interpretResponse(response, request);
|
|
226
|
+
expect(result.length).to.equal(0);
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
it('should get incorrect bid response if id or seat id of response body is missing', function () {
|
|
230
|
+
let response1 = makeResponse();
|
|
231
|
+
delete response1.body.id;
|
|
232
|
+
let result1 = spec.interpretResponse(response1, request);
|
|
233
|
+
expect(result1.length).to.equal(0);
|
|
234
|
+
|
|
235
|
+
let response2 = makeResponse();
|
|
236
|
+
delete response2.body.seatbid;
|
|
237
|
+
let result2 = spec.interpretResponse(response2, request);
|
|
238
|
+
expect(result2.length).to.equal(0);
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
it('should get the correct bid response', function () {
|
|
242
|
+
let result = spec.interpretResponse(makeResponse(), request);
|
|
243
|
+
expect(result.length).to.equal(1);
|
|
244
|
+
expect(result[0]).to.deep.equal(expectedBid);
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
it('should handle a missing crid', function () {
|
|
248
|
+
let noCridResponse = makeResponse();
|
|
249
|
+
delete noCridResponse.body.seatbid[0].bid[0].crid;
|
|
250
|
+
const fallbackCrid = noCridResponse.body.seatbid[0].bid[0].id;
|
|
251
|
+
let noCridResult = Object.assign({}, expectedBid, {'creativeId': fallbackCrid});
|
|
252
|
+
let result = spec.interpretResponse(noCridResponse, request);
|
|
253
|
+
expect(result.length).to.equal(1);
|
|
254
|
+
expect(result[0]).to.deep.equal(noCridResult);
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
it('should handle a missing nurl', function () {
|
|
258
|
+
let noNurlResponse = makeResponse();
|
|
259
|
+
delete noNurlResponse.body.seatbid[0].bid[0].nurl;
|
|
260
|
+
let noNurlResult = Object.assign({}, expectedBid);
|
|
261
|
+
noNurlResult.ad = '<!-- creative -->';
|
|
262
|
+
let result = spec.interpretResponse(noNurlResponse, request);
|
|
263
|
+
expect(result.length).to.equal(1);
|
|
264
|
+
expect(result[0]).to.deep.equal(noNurlResult);
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
it('handles empty bid response', function () {
|
|
268
|
+
let response = {
|
|
269
|
+
body: {
|
|
270
|
+
id: '5e5c23a5ba71e78',
|
|
271
|
+
seatbid: []
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
let result = spec.interpretResponse(response, request);
|
|
275
|
+
expect(result.length).to.equal(0);
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
it('should keep custom properties', () => {
|
|
279
|
+
const customProperties = {test: 'a test message', param: {testParam: 1}};
|
|
280
|
+
const expectedResult = Object.assign({}, expectedBid, {[spec.code]: customProperties});
|
|
281
|
+
const response = makeResponse();
|
|
282
|
+
response.body.seatbid[0].bid[0].ext = customProperties;
|
|
283
|
+
const result = spec.interpretResponse(response, request);
|
|
284
|
+
expect(result.length).to.equal(1);
|
|
285
|
+
expect(result[0]).to.deep.equal(expectedResult);
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
describe('onBidWon', function () {
|
|
290
|
+
const OPEN_RTB_RESP = {
|
|
291
|
+
body: {
|
|
292
|
+
id: 'abc',
|
|
293
|
+
seatbid: [
|
|
294
|
+
{
|
|
295
|
+
bid: [
|
|
296
|
+
{
|
|
297
|
+
'id': 'abc*123*456',
|
|
298
|
+
'impid': 'xxxxxxx',
|
|
299
|
+
'price': 46.657196,
|
|
300
|
+
'adm': '<iframe id="dsp_iframe_228285197" src="https//abc/${AUCTION_PRICE:B64}&creative_id=123"></script>',
|
|
301
|
+
'adomain': ['deltaprojects.com'],
|
|
302
|
+
'h': 600,
|
|
303
|
+
'w': 300,
|
|
304
|
+
'cid': '868253',
|
|
305
|
+
'crid': '732935',
|
|
306
|
+
'cat': [],
|
|
307
|
+
},
|
|
308
|
+
],
|
|
309
|
+
'seat': '2147483647',
|
|
310
|
+
},
|
|
311
|
+
],
|
|
312
|
+
bidid: 'xyz',
|
|
313
|
+
cur: 'USD',
|
|
314
|
+
},
|
|
315
|
+
}
|
|
316
|
+
it('should replace auction price macro', () => {
|
|
317
|
+
const bid = spec.interpretResponse(OPEN_RTB_RESP)[0];
|
|
318
|
+
spec.onBidWon(bid);
|
|
319
|
+
expect(bid.ad).to.contains(`${Math.round(bid.cpm * 1000000)}`);
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
describe('getUserSyncs', function () {
|
|
324
|
+
it('should not do user sync when pixel is disabled', () => {
|
|
325
|
+
const syncOptions = { pixelEnabled: false }
|
|
326
|
+
const result = spec.getUserSyncs(syncOptions)
|
|
327
|
+
expect(result.length).to.equal(0);
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
it('should do user sync without gdpr params when gdprConsent missing', () => {
|
|
331
|
+
const syncOptions = { pixelEnabled: true }
|
|
332
|
+
const gdprConsent = undefined
|
|
333
|
+
const result = spec.getUserSyncs(syncOptions, gdprConsent)
|
|
334
|
+
expect(result[0].url).to.equal(USERSYNC_URL);
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
it('should do user sync with gdpr params when gdprConsent exists', () => {
|
|
338
|
+
const syncOptions = { pixelEnabled: true }
|
|
339
|
+
const gdprConsent = {
|
|
340
|
+
gdprApplies: true,
|
|
341
|
+
consentString: 'ABCABCABC'
|
|
342
|
+
}
|
|
343
|
+
const expectedResult1 = USERSYNC_URL + `?gdpr=${Number(gdprConsent.gdprApplies)}&gdpr_consent=${gdprConsent.consentString}`
|
|
344
|
+
const result1 = spec.getUserSyncs(syncOptions, {}, gdprConsent)
|
|
345
|
+
expect(result1[0].url).to.equal(expectedResult1);
|
|
346
|
+
|
|
347
|
+
delete gdprConsent.gdprApplies
|
|
348
|
+
const result2 = spec.getUserSyncs(syncOptions, {}, gdprConsent)
|
|
349
|
+
const expectedResult2 = USERSYNC_URL + `?gdpr_consent=${gdprConsent.consentString}`
|
|
350
|
+
expect(result2[0].url).to.equal(expectedResult2);
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
describe('getBidFloor', () => {
|
|
355
|
+
it('should not get bid floor when getFloor is not defined', () => {
|
|
356
|
+
const bid = {};
|
|
357
|
+
const currency = 'SEK';
|
|
358
|
+
const result = getBidFloor(bid, 'banner', '*', currency);
|
|
359
|
+
expect(result).to.be.undefined;
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
it('should not get bid floor when getFloor is not a function', () => {
|
|
363
|
+
const bid = { getFloor: 1.0 };
|
|
364
|
+
const currency = 'SEK';
|
|
365
|
+
const result = getBidFloor(bid, 'banner', '*', currency);
|
|
366
|
+
expect(result).to.be.undefined;
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
it('should not get bid floor when getFloor return empty', () => {
|
|
370
|
+
const bid = { getFloor: () => ({}) };
|
|
371
|
+
const currency = 'SEK';
|
|
372
|
+
const result = getBidFloor(bid, 'banner', '*', currency);
|
|
373
|
+
expect(result).to.be.undefined;
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
it('should not get bid floor in SEK when floor is not a number', () => {
|
|
377
|
+
const bid = { getFloor: () => ({ currency: 'SEK', floor: '1.0' }) };
|
|
378
|
+
const currency = 'SEK';
|
|
379
|
+
const result = getBidFloor(bid, 'banner', '*', currency);
|
|
380
|
+
expect(result).to.be.undefined;
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
it('should get bid floor in USD when currency is not defined', () => {
|
|
384
|
+
const bid = { getFloor: () => ({ currency: 'USD', floor: 1.0 }) };
|
|
385
|
+
const currency = undefined;
|
|
386
|
+
const result = getBidFloor(bid, 'banner', '*', currency);
|
|
387
|
+
expect(result.floor).to.equal(1.0);
|
|
388
|
+
expect(result.currency).to.equal('USD');
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
it('should get bid floor in SEK when currency is SEK', () => {
|
|
392
|
+
const bid = { getFloor: () => ({ currency: 'SEK', floor: 1.0 }) };
|
|
393
|
+
const currency = 'SEK';
|
|
394
|
+
const result = getBidFloor(bid, 'banner', '*', currency);
|
|
395
|
+
expect(result.floor).to.equal(1.0);
|
|
396
|
+
expect(result.currency).to.equal('SEK');
|
|
397
|
+
});
|
|
398
|
+
});
|
|
399
|
+
});
|