prebid.js 7.16.0 → 7.17.0

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.
Files changed (131) hide show
  1. package/.circleci/config.yml +0 -18
  2. package/dist/1plusXRtdProvider.js +1 -1
  3. package/dist/33acrossBidAdapter.js +1 -1
  4. package/dist/adagioBidAdapter.js +1 -1
  5. package/dist/adbookpspBidAdapter.js +1 -1
  6. package/dist/adgenerationBidAdapter.js +1 -1
  7. package/dist/adrelevantisBidAdapter.js +1 -1
  8. package/dist/adtrgtmeBidAdapter.js +1 -1
  9. package/dist/adxcgBidAdapter.js +1 -1
  10. package/dist/ajaBidAdapter.js +1 -1
  11. package/dist/amxBidAdapter.js +1 -1
  12. package/dist/amxIdSystem.js +1 -1
  13. package/dist/appierAnalyticsAdapter.js +1 -1
  14. package/dist/appnexusBidAdapter.js +1 -1
  15. package/dist/asoBidAdapter.js +1 -1
  16. package/dist/axonixBidAdapter.js +1 -1
  17. package/dist/bidglassBidAdapter.js +1 -1
  18. package/dist/big-richmediaBidAdapter.js +1 -1
  19. package/dist/bridgewellBidAdapter.js +1 -1
  20. package/dist/brightMountainMediaBidAdapter.js +1 -1
  21. package/dist/carodaBidAdapter.js +1 -0
  22. package/dist/concertBidAdapter.js +1 -1
  23. package/dist/connectadBidAdapter.js +1 -1
  24. package/dist/consumableBidAdapter.js +1 -1
  25. package/dist/conversantBidAdapter.js +1 -1
  26. package/dist/craftBidAdapter.js +1 -1
  27. package/dist/criteoBidAdapter.js +1 -1
  28. package/dist/dspxBidAdapter.js +1 -1
  29. package/dist/eplanningBidAdapter.js +1 -1
  30. package/dist/finativeBidAdapter.js +1 -1
  31. package/dist/glimpseBidAdapter.js +1 -1
  32. package/dist/gmosspBidAdapter.js +1 -1
  33. package/dist/goldbachBidAdapter.js +1 -1
  34. package/dist/gridBidAdapter.js +1 -1
  35. package/dist/gridNMBidAdapter.js +1 -1
  36. package/dist/gumgumBidAdapter.js +1 -1
  37. package/dist/h12mediaBidAdapter.js +1 -1
  38. package/dist/id5IdSystem.js +1 -1
  39. package/dist/improvedigitalBidAdapter.js +1 -1
  40. package/dist/inmarBidAdapter.js +1 -1
  41. package/dist/insticatorBidAdapter.js +1 -1
  42. package/dist/ixBidAdapter.js +1 -1
  43. package/dist/justpremiumBidAdapter.js +1 -1
  44. package/dist/konduitAnalyticsAdapter.js +1 -1
  45. package/dist/kueezBidAdapter.js +1 -1
  46. package/dist/lassoBidAdapter.js +1 -1
  47. package/dist/lifestreetBidAdapter.js +1 -1
  48. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  49. package/dist/logicadBidAdapter.js +1 -1
  50. package/dist/loglyliftBidAdapter.js +1 -1
  51. package/dist/malltvAnalyticsAdapter.js +1 -1
  52. package/dist/marsmediaBidAdapter.js +1 -1
  53. package/dist/mediafuseBidAdapter.js +1 -1
  54. package/dist/mediagoBidAdapter.js +1 -1
  55. package/dist/mediasquareBidAdapter.js +1 -1
  56. package/dist/mgidBidAdapter.js +1 -1
  57. package/dist/minutemediaBidAdapter.js +1 -1
  58. package/dist/not-for-prod/prebid.js +108 -107
  59. package/dist/oguryBidAdapter.js +1 -1
  60. package/dist/onetagBidAdapter.js +1 -1
  61. package/dist/ooloAnalyticsAdapter.js +1 -1
  62. package/dist/outbrainBidAdapter.js +1 -1
  63. package/dist/parrableIdSystem.js +1 -1
  64. package/dist/pixfutureBidAdapter.js +1 -1
  65. package/dist/prebid-core.js +1 -1
  66. package/dist/publinkIdSystem.js +1 -1
  67. package/dist/pubmaticBidAdapter.js +1 -1
  68. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  69. package/dist/pxyzBidAdapter.js +1 -1
  70. package/dist/quantcastBidAdapter.js +1 -1
  71. package/dist/readpeakBidAdapter.js +1 -1
  72. package/dist/relaidoBidAdapter.js +1 -1
  73. package/dist/rhythmoneBidAdapter.js +1 -1
  74. package/dist/riseBidAdapter.js +1 -1
  75. package/dist/rubiconAnalyticsAdapter.js +1 -1
  76. package/dist/rubiconBidAdapter.js +1 -1
  77. package/dist/seedingAllianceBidAdapter.js +1 -1
  78. package/dist/seedtagBidAdapter.js +1 -1
  79. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  80. package/dist/sharethroughBidAdapter.js +1 -1
  81. package/dist/shinezBidAdapter.js +1 -1
  82. package/dist/smaatoBidAdapter.js +1 -1
  83. package/dist/smartadserverBidAdapter.js +1 -1
  84. package/dist/smartxBidAdapter.js +1 -1
  85. package/dist/smilewantedBidAdapter.js +1 -1
  86. package/dist/sonobiBidAdapter.js +1 -1
  87. package/dist/sovrnAnalyticsAdapter.js +1 -1
  88. package/dist/sovrnBidAdapter.js +1 -1
  89. package/dist/sspBCBidAdapter.js +1 -1
  90. package/dist/sublimeBidAdapter.js +1 -1
  91. package/dist/synacormediaBidAdapter.js +1 -1
  92. package/dist/targetVideoBidAdapter.js +1 -1
  93. package/dist/teadsBidAdapter.js +1 -1
  94. package/dist/trionBidAdapter.js +1 -1
  95. package/dist/tripleliftBidAdapter.js +1 -1
  96. package/dist/ttdBidAdapter.js +1 -1
  97. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  98. package/dist/underdogmediaBidAdapter.js +1 -1
  99. package/dist/undertoneBidAdapter.js +1 -1
  100. package/dist/vidazooBidAdapter.js +1 -1
  101. package/dist/videobyteBidAdapter.js +1 -1
  102. package/dist/visxBidAdapter.js +1 -1
  103. package/dist/vuukleBidAdapter.js +1 -1
  104. package/dist/widespaceBidAdapter.js +1 -1
  105. package/dist/winrBidAdapter.js +1 -1
  106. package/dist/yahoosspBidAdapter.js +1 -1
  107. package/dist/yieldmoBidAdapter.js +1 -1
  108. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  109. package/karma.conf.maker.js +2 -4
  110. package/modules/1plusXRtdProvider.js +27 -7
  111. package/modules/adagioBidAdapter.js +16 -2
  112. package/modules/adagioBidAdapter.md +11 -1
  113. package/modules/appnexusBidAdapter.js +24 -22
  114. package/modules/carodaBidAdapter.js +217 -0
  115. package/modules/carodaBidAdapter.md +43 -0
  116. package/modules/improvedigitalBidAdapter.js +3 -1
  117. package/modules/ixBidAdapter.js +17 -12
  118. package/modules/mediagoBidAdapter.js +15 -11
  119. package/modules/mediasquareBidAdapter.js +1 -1
  120. package/modules/rubiconAnalyticsAdapter.js +2 -2
  121. package/modules/rubiconBidAdapter.js +16 -6
  122. package/package.json +1 -1
  123. package/test/spec/modules/1plusXRtdProvider_spec.js +77 -1
  124. package/test/spec/modules/adagioBidAdapter_spec.js +23 -2
  125. package/test/spec/modules/appnexusBidAdapter_spec.js +76 -0
  126. package/test/spec/modules/carodaBidAdapter_spec.js +494 -0
  127. package/test/spec/modules/improvedigitalBidAdapter_spec.js +10 -0
  128. package/test/spec/modules/ixBidAdapter_spec.js +32 -16
  129. package/test/spec/modules/mediasquareBidAdapter_spec.js +2 -0
  130. package/test/spec/modules/rubiconAnalyticsAdapter_spec.js +7 -7
  131. package/test/spec/modules/rubiconBidAdapter_spec.js +28 -35
@@ -0,0 +1,494 @@
1
+ // jshint esversion: 6, es3: false, node: true
2
+ import { assert } from 'chai';
3
+ import { spec } from 'modules/carodaBidAdapter.js';
4
+ import { config } from 'src/config.js';
5
+ import { createEidsArray } from 'modules/userId/eids.js';
6
+
7
+ describe('Caroda adapter', function () {
8
+ let bids = [];
9
+
10
+ describe('isBidRequestValid', function () {
11
+ let bid = {
12
+ 'bidder': 'caroda',
13
+ 'params': {
14
+ 'ctok': 'adf232eef344'
15
+ }
16
+ };
17
+
18
+ it('should return true when required params found', function () {
19
+ assert(spec.isBidRequestValid(bid));
20
+
21
+ bid.params = {
22
+ ctok: 'adf232eef344',
23
+ placementId: 'someplacement'
24
+ };
25
+ assert(spec.isBidRequestValid(bid));
26
+ });
27
+
28
+ it('should return false when required params are missing', function () {
29
+ bid.params = {};
30
+ assert.isFalse(spec.isBidRequestValid(bid));
31
+
32
+ bid.params = {
33
+ placementId: 'someplacement'
34
+ };
35
+ assert.isFalse(spec.isBidRequestValid(bid));
36
+ });
37
+ });
38
+
39
+ describe('buildRequests', function () {
40
+ beforeEach(function () {
41
+ config.resetConfig();
42
+ delete window.carodaPageViewId;
43
+ });
44
+ it('should send request with minimal structure', function () {
45
+ const validBidRequests = [{
46
+ bid_id: 'bidId',
47
+ params: {
48
+ 'ctok': 'adf232eef344'
49
+ }
50
+ }];
51
+ window.top.carodaPageViewId = 12345;
52
+ const request = spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } })[0];
53
+ assert.equal(request.method, 'POST');
54
+ assert.equal(request.url, 'https://prebid.caroda.io/api/hb?entry_id=12345');
55
+ assert.equal(request.options, undefined);
56
+ const data = JSON.parse(request.data)
57
+ assert.equal(data.ctok, 'adf232eef344');
58
+ assert.ok(data.site);
59
+ assert.ok(data.hb_version);
60
+ assert.ok(data.device);
61
+ assert.equal(data.price_type, 'net');
62
+ });
63
+
64
+ it('should add test to request, if test is set in parameters', function () {
65
+ const validBidRequests = [{
66
+ bid_id: 'bidId',
67
+ params: {
68
+ 'ctok': 'adf232eef344',
69
+ 'test': 1
70
+ }
71
+ }];
72
+ window.top.carodaPageViewId = 12345;
73
+ const request = spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } })[0];
74
+ const data = JSON.parse(request.data)
75
+ assert.equal(data.test, 1);
76
+ });
77
+
78
+ it('should add placement_id to request when available', function () {
79
+ const validBidRequests = [{
80
+ bid_id: 'bidId',
81
+ params: {
82
+ 'ctok': 'adf232eef344',
83
+ 'placementId': 'opzafe342f'
84
+ }
85
+ }];
86
+ window.top.carodaPageViewId = 12345;
87
+ const request = spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } })[0];
88
+ const data = JSON.parse(request.data);
89
+ assert.equal(data.placement_id, 'opzafe342f');
90
+ });
91
+
92
+ it('should send info about device', function () {
93
+ config.setConfig({
94
+ device: { w: 100, h: 100 }
95
+ });
96
+ const validBidRequests = [{
97
+ bid_id: 'bidId',
98
+ params: { 'ctok': 'adf232eef344' }
99
+ }];
100
+ const data = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } })[0].data);
101
+ assert.equal(data.device.ua, navigator.userAgent);
102
+ assert.equal(data.device.w, 100);
103
+ assert.equal(data.device.h, 100);
104
+ });
105
+
106
+ it('should pass supply chain object', function () {
107
+ const validBidRequests = [{
108
+ bid_id: 'bidId',
109
+ params: {},
110
+ schain: {
111
+ validation: 'strict',
112
+ config: {
113
+ ver: '1.0'
114
+ }
115
+ }
116
+ }];
117
+
118
+ let data = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } })[0].data);
119
+ assert.deepEqual(data.schain, {
120
+ validation: 'strict',
121
+ config: {
122
+ ver: '1.0'
123
+ }
124
+ });
125
+ });
126
+
127
+ it('should send app info', function () {
128
+ config.setConfig({
129
+ app: { id: 'appid' },
130
+ });
131
+ const ortb2 = { app: { name: 'appname' } };
132
+ let validBidRequests = [{
133
+ bid_id: 'bidId',
134
+ params: { mid: '1000' },
135
+ ortb2
136
+ }];
137
+ let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' }, ortb2 })[0].data);
138
+ assert.equal(request.app.id, 'appid');
139
+ assert.equal(request.app.name, 'appname');
140
+ assert.equal(request.site, undefined);
141
+ });
142
+
143
+ it('should send info about the site', function () {
144
+ config.setConfig({
145
+ site: {
146
+ id: '123123',
147
+ publisher: {
148
+ domain: 'publisher.domain.com'
149
+ }
150
+ },
151
+ });
152
+ const ortb2 = {
153
+ site: {
154
+ publisher: {
155
+ name: 'publisher\'s name'
156
+ }
157
+ }
158
+ };
159
+ let validBidRequests = [{
160
+ bid_id: 'bidId',
161
+ params: { mid: '1000' },
162
+ ortb2
163
+ }];
164
+ let refererInfo = { page: 'page' };
165
+ let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo, ortb2 })[0].data);
166
+
167
+ assert.deepEqual(request.site, {
168
+ page: refererInfo.page,
169
+ publisher: {
170
+ domain: 'publisher.domain.com',
171
+ name: 'publisher\'s name'
172
+ },
173
+ id: '123123'
174
+ });
175
+ });
176
+
177
+ it('should send correct priceType value', function () {
178
+ let validBidRequests = [{
179
+ bid_id: 'bidId',
180
+ params: { priceType: 'gross' }
181
+ }];
182
+ let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } })[0].data);
183
+
184
+ assert.equal(request.price_type, 'gross');
185
+ });
186
+
187
+ it('should send currency if defined', function () {
188
+ config.setConfig({ currency: { adServerCurrency: 'EUR' } });
189
+ let validBidRequests = [{ params: {} }];
190
+ let refererInfo = { page: 'page' };
191
+ let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo })[0].data);
192
+
193
+ assert.deepEqual(request.currency, 'EUR');
194
+ });
195
+
196
+ it('should pass extended ids', function () {
197
+ let validBidRequests = [{
198
+ bid_id: 'bidId',
199
+ params: {},
200
+ userIdAsEids: createEidsArray({
201
+ tdid: 'TTD_ID_FROM_USER_ID_MODULE',
202
+ pubcid: 'pubCommonId_FROM_USER_ID_MODULE'
203
+ })
204
+ }];
205
+
206
+ let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } })[0].data);
207
+ assert.deepEqual(request.user.eids, [
208
+ { source: 'adserver.org', uids: [ { id: 'TTD_ID_FROM_USER_ID_MODULE', atype: 1, ext: { rtiPartner: 'TDID' } } ] },
209
+ { source: 'pubcid.org', uids: [ { id: 'pubCommonId_FROM_USER_ID_MODULE', atype: 1 } ] }
210
+ ]);
211
+ });
212
+
213
+ describe('user privacy', function () {
214
+ it('should send GDPR Consent data to adform if gdprApplies', function () {
215
+ let validBidRequests = [{ bid_id: 'bidId', params: { test: 1 } }];
216
+ let bidderRequest = { gdprConsent: { gdprApplies: true, consentString: 'consentDataString' }, refererInfo: { page: 'page' } };
217
+ let request = JSON.parse(spec.buildRequests(validBidRequests, bidderRequest)[0].data);
218
+
219
+ assert.equal(request.privacy.gdpr_consent, bidderRequest.gdprConsent.consentString);
220
+ assert.equal(request.privacy.gdpr, bidderRequest.gdprConsent.gdprApplies);
221
+ assert.equal(typeof request.privacy.gdpr, 'number');
222
+ });
223
+
224
+ it('should send gdpr as number', function () {
225
+ let validBidRequests = [{ bid_id: 'bidId', params: { test: 1 } }];
226
+ let bidderRequest = { gdprConsent: { gdprApplies: true, consentString: 'consentDataString' }, refererInfo: { page: 'page' } };
227
+ let request = JSON.parse(spec.buildRequests(validBidRequests, bidderRequest)[0].data);
228
+
229
+ assert.equal(typeof request.privacy.gdpr, 'number');
230
+ assert.equal(request.privacy.gdpr, 1);
231
+ });
232
+
233
+ it('should send CCPA Consent data', function () {
234
+ let validBidRequests = [{ bid_id: 'bidId', params: { test: 1 } }];
235
+ let bidderRequest = { uspConsent: '1YA-', refererInfo: { page: 'page' } };
236
+ let request = JSON.parse(spec.buildRequests(validBidRequests, bidderRequest)[0].data);
237
+
238
+ assert.equal(request.privacy.us_privacy, '1YA-');
239
+
240
+ bidderRequest = { uspConsent: '1YA-', gdprConsent: { gdprApplies: true, consentString: 'consentDataString' }, refererInfo: { page: 'page' } };
241
+ request = JSON.parse(spec.buildRequests(validBidRequests, bidderRequest)[0].data);
242
+
243
+ assert.equal(request.privacy.us_privacy, '1YA-');
244
+ assert.equal(request.privacy.gdpr_consent, 'consentDataString');
245
+ assert.equal(request.privacy.gdpr, 1);
246
+ });
247
+
248
+ it('should not set coppa when coppa is not provided or is set to false', function () {
249
+ config.setConfig({
250
+ });
251
+ let validBidRequests = [{ bid_id: 'bidId', params: { test: 1 } }];
252
+ let bidderRequest = { gdprConsent: { gdprApplies: true, consentString: 'consentDataString' }, refererInfo: { page: 'page' } };
253
+ let request = JSON.parse(spec.buildRequests(validBidRequests, bidderRequest)[0].data);
254
+
255
+ assert.equal(request.privacy.coppa, undefined);
256
+
257
+ config.setConfig({
258
+ coppa: false
259
+ });
260
+ request = JSON.parse(spec.buildRequests(validBidRequests, bidderRequest)[0].data);
261
+
262
+ assert.equal(request.privacy.coppa, undefined);
263
+ });
264
+ it('should set coppa to 1 when coppa is provided with value true', function () {
265
+ config.setConfig({
266
+ coppa: true
267
+ });
268
+ let validBidRequests = [{ bid_id: 'bidId', params: { test: 1 } }];
269
+ let request = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } })[0].data);
270
+
271
+ assert.equal(request.privacy.coppa, 1);
272
+ });
273
+ });
274
+
275
+ describe('bids', function () {
276
+ it('should be able to handle multiple bids', function () {
277
+ const validBidRequests = [{
278
+ bid_id: 'bidId',
279
+ params: { ctok: 'ctok1' }
280
+ }, {
281
+ bid_id: 'bidId2',
282
+ params: { ctok: 'ctok2' }
283
+ }];
284
+ const request = spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } });
285
+ assert.equal(request.length, 2);
286
+ const data = request.map(r => JSON.parse(r.data));
287
+ assert.equal(data[0].ctok, 'ctok1');
288
+ assert.equal(data[1].ctok, 'ctok2');
289
+ });
290
+
291
+ describe('price floors', function () {
292
+ it('should not add if floors module not configured', function () {
293
+ const validBidRequests = [{ bid_id: 'bidId', params: {ctok: 'ctok1'}, mediaTypes: {video: {}} }];
294
+ const imp = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } })[0].data);
295
+ assert.equal(imp.bidfloor, undefined);
296
+ assert.equal(imp.bidfloorcur, undefined);
297
+ });
298
+
299
+ it('should not add if floor price not defined', function () {
300
+ const validBidRequests = [ getBidWithFloor() ];
301
+ const imp = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } })[0].data);
302
+ assert.equal(imp.bidfloor, undefined);
303
+ assert.equal(imp.bidfloorcur, 'EUR');
304
+ });
305
+
306
+ it('should request floor price in adserver currency', function () {
307
+ config.setConfig({ currency: { adServerCurrency: 'DKK' } });
308
+ const validBidRequests = [ getBidWithFloor() ];
309
+ const imp = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } })[0].data);
310
+ assert.equal(imp.bidfloor, undefined);
311
+ assert.equal(imp.bidfloorcur, 'DKK');
312
+ });
313
+
314
+ it('should add correct floor values', function () {
315
+ const expectedFloors = [ 1, 1.3, 0.5 ];
316
+ const validBidRequests = expectedFloors.map(getBidWithFloor);
317
+ const imps = spec
318
+ .buildRequests(validBidRequests, { refererInfo: { page: 'page' } })
319
+ .map(r => JSON.parse(r.data));
320
+ expectedFloors.forEach((floor, index) => {
321
+ assert.equal(imps[index].bidfloor, floor);
322
+ assert.equal(imps[index].bidfloorcur, 'EUR');
323
+ });
324
+ });
325
+
326
+ function getBidWithFloor(floor) {
327
+ return {
328
+ params: { ctok: 'ctok1' },
329
+ mediaTypes: { video: {} },
330
+ getFloor: ({ currency }) => {
331
+ return {
332
+ currency: currency,
333
+ floor
334
+ };
335
+ }
336
+ };
337
+ }
338
+ });
339
+
340
+ describe('multiple media types', function () {
341
+ it('should use all configured media types for bidding', function () {
342
+ const validBidRequests = [{
343
+ bid_id: 'bidId',
344
+ params: { ctok: 'ctok1' },
345
+ mediaTypes: {
346
+ banner: {
347
+ sizes: [[100, 100], [200, 300]]
348
+ },
349
+ video: {}
350
+ }
351
+ }, {
352
+ bid_id: 'bidId2',
353
+ params: { ctok: 'ctok1' },
354
+ mediaTypes: {
355
+ video: {},
356
+ native: {}
357
+ }
358
+ }];
359
+ const [ first, second ] = spec
360
+ .buildRequests(validBidRequests, { refererInfo: { page: 'page' } })
361
+ .map(r => JSON.parse(r.data));
362
+
363
+ assert.ok(first.banner);
364
+ assert.ok(first.video);
365
+
366
+ assert.ok(second.video);
367
+ assert.equal(second.banner, undefined);
368
+ });
369
+ });
370
+
371
+ describe('banner', function () {
372
+ it('should convert sizes to openrtb format', function () {
373
+ const validBidRequests = [{
374
+ bid_id: 'bidId',
375
+ params: { mid: 1000 },
376
+ mediaTypes: {
377
+ banner: {
378
+ sizes: [[100, 100], [200, 300]]
379
+ }
380
+ }
381
+ }];
382
+ const { banner } = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } })[0].data);
383
+ assert.deepEqual(banner, {
384
+ format: [ { w: 100, h: 100 }, { w: 200, h: 300 } ]
385
+ });
386
+ });
387
+ });
388
+
389
+ describe('video', function () {
390
+ it('should pass video mediatype config', function () {
391
+ const validBidRequests = [{
392
+ bid_id: 'bidId',
393
+ params: { mid: 1000 },
394
+ mediaTypes: {
395
+ video: {
396
+ playerSize: [640, 480],
397
+ context: 'outstream',
398
+ mimes: ['video/mp4']
399
+ }
400
+ }
401
+ }];
402
+ const { video } = JSON.parse(spec.buildRequests(validBidRequests, { refererInfo: { page: 'page' } })[0].data);
403
+ assert.deepEqual(video, {
404
+ playerSize: [640, 480],
405
+ context: 'outstream',
406
+ mimes: ['video/mp4']
407
+ });
408
+ });
409
+ });
410
+ });
411
+ });
412
+
413
+ describe('interpretResponse', function () {
414
+ it('should return if no body in response', function () {
415
+ const serverResponse = {};
416
+ const bidRequest = {};
417
+ assert.ok(!spec.interpretResponse(serverResponse, bidRequest));
418
+ });
419
+ const basicBidResponse = () => ({
420
+ bid_id: 'bidId',
421
+ cpm: 10,
422
+ creative_id: '12345',
423
+ currency: 'CZK',
424
+ w: 100,
425
+ h: 100,
426
+ ad: '<script....',
427
+ placement_id: 'opzafe23'
428
+ });
429
+ const bidRequest = () => ({
430
+ data: {},
431
+ bids: [
432
+ {
433
+ bid_id: 'bidId1',
434
+ params: { ctok: 'ctok1' }
435
+ },
436
+ {
437
+ bid_id: 'bidId2',
438
+ params: { ctok: 'ctok2' }
439
+ }
440
+ ]
441
+ });
442
+ it('should parse a typical ok response', function () {
443
+ const serverResponse = {
444
+ body: { ok: { value: JSON.stringify([basicBidResponse()]) } }
445
+ };
446
+ bids = spec.interpretResponse(serverResponse, bidRequest());
447
+ assert.equal(bids.length, 1);
448
+ assert.deepEqual(bids[0],
449
+ {
450
+ requestId: 'bidId',
451
+ cpm: 10,
452
+ creativeId: '12345',
453
+ ttl: 300,
454
+ netRevenue: true,
455
+ currency: 'CZK',
456
+ width: 100,
457
+ height: 100,
458
+ meta: {
459
+ advertiserDomains: []
460
+ },
461
+ ad: '<script....',
462
+ placementId: 'opzafe23'
463
+ });
464
+ });
465
+ it('should add adserverTargeting', function () {
466
+ const serverResponse = {
467
+ body: {
468
+ ok: {
469
+ value: JSON.stringify([{
470
+ ...basicBidResponse(),
471
+ adserver_targeting: { tag: 'value' }
472
+ }])
473
+ }
474
+ }
475
+ };
476
+ bids = spec.interpretResponse(serverResponse, bidRequest());
477
+ assert.deepEqual(bids[0].adserverTargeting, { tag: 'value' });
478
+ });
479
+ it('should add adomains', function () {
480
+ const serverResponse = {
481
+ body: {
482
+ ok: {
483
+ value: JSON.stringify([{
484
+ ...basicBidResponse(),
485
+ adomain: ['a.b.c']
486
+ }])
487
+ }
488
+ }
489
+ };
490
+ bids = spec.interpretResponse(serverResponse, bidRequest());
491
+ assert.deepEqual(bids[0].meta.advertiserDomains, ['a.b.c']);
492
+ });
493
+ });
494
+ });
@@ -8,6 +8,7 @@ import { deepSetValue } from '../../../src/utils';
8
8
  describe('Improve Digital Adapter Tests', function () {
9
9
  const METHOD = 'POST';
10
10
  const AD_SERVER_URL = 'https://ad.360yield.com/pb';
11
+ const BASIC_ADS_URL = 'https://ad.360yield-basic.com/pb';
11
12
  const EXTEND_URL = 'https://pbs.360yield.com/openrtb2/auction';
12
13
  const IFRAME_SYNC_URL = 'https://hb.360yield.com/prebid-universal-creative/load-cookie.html';
13
14
  const INSTREAM_TYPE = 1;
@@ -752,6 +753,15 @@ describe('Improve Digital Adapter Tests', function () {
752
753
  expect(payload.app).does.not.exist;
753
754
  });
754
755
 
756
+ it('should call basic ads endpoint when no consent for purpose 1', function () {
757
+ const consent = deepClone(gdprConsent);
758
+ deepSetValue(consent, 'vendorData.purpose.consents.1', false);
759
+ const bidderRequestWithConsent = deepClone(bidderRequest);
760
+ bidderRequestWithConsent.gdprConsent = consent;
761
+ const request = spec.buildRequests([simpleBidRequest], bidderRequestWithConsent)[0];
762
+ expect(request.url).to.equal(BASIC_ADS_URL);
763
+ });
764
+
755
765
  it('should set extend params when extend mode enabled from global configuration', function () {
756
766
  getConfigStub = sinon.stub(config, 'getConfig');
757
767
  const bannerRequest = deepClone(simpleBidRequest);