prebid.js 6.20.0 → 6.22.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 (159) hide show
  1. package/.circleci/config.yml +0 -1
  2. package/dist/33acrossBidAdapter.js +1 -1
  3. package/dist/adagioBidAdapter.js +1 -1
  4. package/dist/adbookpspBidAdapter.js +1 -1
  5. package/dist/adgenerationBidAdapter.js +1 -1
  6. package/dist/adomikAnalyticsAdapter.js +1 -1
  7. package/dist/adotBidAdapter.js +1 -1
  8. package/dist/adrelevantisBidAdapter.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/apacdexBidAdapter.js +1 -1
  14. package/dist/appierAnalyticsAdapter.js +1 -1
  15. package/dist/appnexusBidAdapter.js +1 -1
  16. package/dist/asoBidAdapter.js +1 -1
  17. package/dist/audiencerunBidAdapter.js +1 -1
  18. package/dist/axonixBidAdapter.js +1 -1
  19. package/dist/betweenBidAdapter.js +1 -1
  20. package/dist/bidglassBidAdapter.js +1 -1
  21. package/dist/big-richmediaBidAdapter.js +1 -1
  22. package/dist/bridgewellBidAdapter.js +1 -1
  23. package/dist/brightMountainMediaBidAdapter.js +1 -1
  24. package/dist/cointrafficBidAdapter.js +1 -1
  25. package/dist/colossussspBidAdapter.js +1 -1
  26. package/dist/concertBidAdapter.js +1 -1
  27. package/dist/connectadBidAdapter.js +1 -1
  28. package/dist/consentManagement.js +1 -1
  29. package/dist/consentManagementUsp.js +1 -1
  30. package/dist/consumableBidAdapter.js +1 -1
  31. package/dist/conversantBidAdapter.js +1 -1
  32. package/dist/craftBidAdapter.js +1 -1
  33. package/dist/criteoBidAdapter.js +1 -1
  34. package/dist/dspxBidAdapter.js +1 -1
  35. package/dist/e_volutionBidAdapter.js +1 -1
  36. package/dist/eplanningBidAdapter.js +1 -1
  37. package/dist/ftrackIdSystem.js +1 -1
  38. package/dist/glimpseBidAdapter.js +1 -1
  39. package/dist/gmosspBidAdapter.js +1 -1
  40. package/dist/goldbachBidAdapter.js +1 -1
  41. package/dist/gridBidAdapter.js +1 -1
  42. package/dist/gridNMBidAdapter.js +1 -1
  43. package/dist/gumgumBidAdapter.js +1 -1
  44. package/dist/h12mediaBidAdapter.js +1 -1
  45. package/dist/id5IdSystem.js +1 -1
  46. package/dist/improvedigitalBidAdapter.js +1 -1
  47. package/dist/inmarBidAdapter.js +1 -1
  48. package/dist/insticatorBidAdapter.js +1 -1
  49. package/dist/ixBidAdapter.js +1 -1
  50. package/dist/justpremiumBidAdapter.js +1 -1
  51. package/dist/konduitAnalyticsAdapter.js +1 -1
  52. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  53. package/dist/logicadBidAdapter.js +1 -1
  54. package/dist/loglyliftBidAdapter.js +1 -1
  55. package/dist/malltvAnalyticsAdapter.js +1 -1
  56. package/dist/marsmediaBidAdapter.js +1 -1
  57. package/dist/mediafuseBidAdapter.js +1 -1
  58. package/dist/mediasquareBidAdapter.js +1 -1
  59. package/dist/mgidBidAdapter.js +1 -1
  60. package/dist/minutemediaBidAdapter.js +1 -1
  61. package/dist/mobfoxpbBidAdapter.js +1 -0
  62. package/dist/nextMillenniumBidAdapter.js +1 -1
  63. package/dist/nexx360BidAdapter.js +1 -1
  64. package/dist/not-for-prod/prebid.js +118 -117
  65. package/dist/oguryBidAdapter.js +1 -1
  66. package/dist/oneVideoBidAdapter.js +1 -1
  67. package/dist/onetagBidAdapter.js +1 -1
  68. package/dist/ooloAnalyticsAdapter.js +1 -1
  69. package/dist/otmBidAdapter.js +1 -1
  70. package/dist/outbrainBidAdapter.js +1 -1
  71. package/dist/parrableIdSystem.js +1 -1
  72. package/dist/pixfutureBidAdapter.js +1 -1
  73. package/dist/prebid-core.js +3 -3
  74. package/dist/prebidServerBidAdapter.js +1 -1
  75. package/dist/publinkIdSystem.js +1 -1
  76. package/dist/pubmaticBidAdapter.js +1 -1
  77. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  78. package/dist/pxyzBidAdapter.js +1 -1
  79. package/dist/quantcastBidAdapter.js +1 -1
  80. package/dist/readpeakBidAdapter.js +1 -1
  81. package/dist/relaidoBidAdapter.js +1 -1
  82. package/dist/rhythmoneBidAdapter.js +1 -1
  83. package/dist/riseBidAdapter.js +1 -1
  84. package/dist/rubiconAnalyticsAdapter.js +1 -1
  85. package/dist/rubiconBidAdapter.js +1 -1
  86. package/dist/seedingAllianceBidAdapter.js +1 -1
  87. package/dist/seedtagBidAdapter.js +1 -1
  88. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  89. package/dist/sharethroughBidAdapter.js +1 -1
  90. package/dist/smaatoBidAdapter.js +1 -1
  91. package/dist/smartadserverBidAdapter.js +1 -1
  92. package/dist/smartxBidAdapter.js +1 -1
  93. package/dist/smilewantedBidAdapter.js +1 -1
  94. package/dist/sonobiBidAdapter.js +1 -1
  95. package/dist/sortableBidAdapter.js +1 -1
  96. package/dist/sovrnAnalyticsAdapter.js +1 -1
  97. package/dist/sovrnBidAdapter.js +1 -1
  98. package/dist/sspBCBidAdapter.js +1 -1
  99. package/dist/sublimeBidAdapter.js +1 -1
  100. package/dist/synacormediaBidAdapter.js +1 -1
  101. package/dist/targetVideoBidAdapter.js +1 -1
  102. package/dist/teadsBidAdapter.js +1 -1
  103. package/dist/trionBidAdapter.js +1 -1
  104. package/dist/tripleliftBidAdapter.js +1 -1
  105. package/dist/trustxBidAdapter.js +1 -1
  106. package/dist/ttdBidAdapter.js +1 -1
  107. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  108. package/dist/underdogmediaBidAdapter.js +1 -1
  109. package/dist/undertoneBidAdapter.js +1 -1
  110. package/dist/vidazooBidAdapter.js +1 -1
  111. package/dist/videobyteBidAdapter.js +1 -1
  112. package/dist/visxBidAdapter.js +1 -1
  113. package/dist/vuukleBidAdapter.js +1 -1
  114. package/dist/widespaceBidAdapter.js +1 -1
  115. package/dist/winrBidAdapter.js +1 -1
  116. package/dist/yahoosspBidAdapter.js +1 -1
  117. package/dist/yieldmoBidAdapter.js +1 -1
  118. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  119. package/modules/adomikAnalyticsAdapter.js +67 -43
  120. package/modules/adotBidAdapter.js +1 -1
  121. package/modules/apacdexBidAdapter.js +52 -41
  122. package/modules/audiencerunBidAdapter.js +75 -22
  123. package/modules/betweenBidAdapter.js +1 -1
  124. package/modules/cointrafficBidAdapter.js +1 -1
  125. package/modules/colossussspBidAdapter.js +5 -1
  126. package/modules/consentManagement.js +4 -4
  127. package/modules/consentManagementUsp.js +2 -2
  128. package/modules/e_volutionBidAdapter.js +19 -1
  129. package/modules/ftrackIdSystem.js +16 -2
  130. package/modules/ftrackIdSystem.md +12 -1
  131. package/modules/malltvAnalyticsAdapter.js +1 -1
  132. package/modules/mobfoxpbBidAdapter.js +135 -0
  133. package/modules/mobfoxpbBidAdapter.md +3 -3
  134. package/modules/nextMillenniumBidAdapter.js +6 -2
  135. package/modules/nexx360BidAdapter.js +14 -4
  136. package/modules/otmBidAdapter.js +43 -35
  137. package/modules/prebidServerBidAdapter/index.js +58 -14
  138. package/modules/pubmaticBidAdapter.js +34 -2
  139. package/modules/seedingAllianceBidAdapter.js +8 -4
  140. package/package.json +1 -1
  141. package/src/adapters/bidderFactory.js +17 -0
  142. package/src/auction.js +1 -7
  143. package/test/spec/auctionmanager_spec.js +2 -0
  144. package/test/spec/modules/adomikAnalyticsAdapter_spec.js +133 -33
  145. package/test/spec/modules/adotBidAdapter_spec.js +1 -1
  146. package/test/spec/modules/apacdexBidAdapter_spec.js +6 -6
  147. package/test/spec/modules/audiencerunBidAdapter_spec.js +185 -97
  148. package/test/spec/modules/cointrafficBidAdapter_spec.js +1 -1
  149. package/test/spec/modules/colossussspBidAdapter_spec.js +97 -3
  150. package/test/spec/modules/consentManagementUsp_spec.js +1 -0
  151. package/test/spec/modules/consentManagement_spec.js +22 -0
  152. package/test/spec/modules/e_volutionBidAdapter_spec.js +67 -10
  153. package/test/spec/modules/ftrackIdSystem_spec.js +75 -1
  154. package/test/spec/modules/mobfoxpbBidAdapter_spec.js +307 -0
  155. package/test/spec/modules/nexx360BidAdapter_spec.js +49 -0
  156. package/test/spec/modules/otmBidAdapter_spec.js +32 -11
  157. package/test/spec/modules/prebidServerBidAdapter_spec.js +200 -0
  158. package/test/spec/modules/pubmaticBidAdapter_spec.js +129 -0
  159. package/test/spec/unit/core/bidderFactory_spec.js +137 -0
@@ -8,65 +8,68 @@ const BID_SERVER_RESPONSE = {
8
8
  body: {
9
9
  bid: [
10
10
  {
11
- 'bidId': '51ef8751f9aead',
12
- 'zoneId': '12345abcde',
13
- 'crid': '5678',
14
- 'cpm': 8.021951999999999999,
15
- 'currency': 'USD',
16
- 'w': 728,
17
- 'h': 90,
18
- 'isNet': false,
19
- 'buying_type': 'rtb',
20
- 'syncUrl': 'https://ac.audiencerun.com/f/sync.html',
21
- 'adm': '<!-- test creative -->',
22
- 'adomain': ['example.com']
23
- }
24
- ]
25
- }
11
+ bidId: '51ef8751f9aead',
12
+ zoneId: '12345abcde',
13
+ crid: '5678',
14
+ cpm: 8.0219519,
15
+ currency: 'USD',
16
+ w: 728,
17
+ h: 90,
18
+ isNet: false,
19
+ buying_type: 'rtb',
20
+ syncUrl: 'https://ac.audiencerun.com/f/sync.html',
21
+ adm: '<!-- test creative -->',
22
+ adomain: ['example.com'],
23
+ },
24
+ ],
25
+ },
26
26
  };
27
27
 
28
- describe('AudienceRun bid adapter tests', function() {
28
+ describe('AudienceRun bid adapter tests', function () {
29
29
  const adapter = newBidder(spec);
30
30
 
31
- describe('inherited functions', function() {
32
- it('exists and is a function', function() {
31
+ describe('inherited functions', function () {
32
+ it('exists and is a function', function () {
33
33
  expect(adapter.callBids).to.exist.and.to.be.a('function');
34
34
  });
35
35
  });
36
36
 
37
- describe('isBidRequestValid', function() {
37
+ describe('isBidRequestValid', function () {
38
38
  let bid = {
39
- 'bidder': 'audiencerun',
40
- 'params': {
41
- 'zoneId': '12345abcde'
39
+ bidder: 'audiencerun',
40
+ params: {
41
+ zoneId: '12345abcde',
42
42
  },
43
- 'adUnitCode': 'adunit-code',
44
- 'mediaTypes': {
45
- 'banner': {
46
- 'sizes': [[300, 250], [300, 600]]
47
- }
43
+ adUnitCode: 'adunit-code',
44
+ mediaTypes: {
45
+ banner: {
46
+ sizes: [
47
+ [300, 250],
48
+ [300, 600],
49
+ ],
50
+ },
48
51
  },
49
- 'bidId': '30b31c1838de1e',
50
- 'bidderRequestId': '22edbae2733bf6',
51
- 'auctionId': '1d1a030790a475',
52
- 'creativeId': 'er2ee'
52
+ bidId: '30b31c1838de1e',
53
+ bidderRequestId: '22edbae2733bf6',
54
+ auctionId: '1d1a030790a475',
55
+ creativeId: 'er2ee',
53
56
  };
54
57
 
55
- it('should return true when required params found', function() {
58
+ it('should return true when required params found', function () {
56
59
  expect(spec.isBidRequestValid(bid)).to.equal(true);
57
60
  });
58
61
 
59
- it('should return true when zoneId is valid', function() {
62
+ it('should return true when zoneId is valid', function () {
60
63
  let bid = Object.assign({}, bid);
61
64
  delete bid.params;
62
65
  bid.params = {
63
- 'zoneId': '12345abcde'
66
+ zoneId: '12345abcde',
64
67
  };
65
68
 
66
69
  expect(spec.isBidRequestValid(bid)).to.equal(true);
67
70
  });
68
71
 
69
- it('should return false when required params are not passed', function() {
72
+ it('should return false when required params are not passed', function () {
70
73
  let bid = Object.assign({}, bid);
71
74
  delete bid.params;
72
75
 
@@ -76,38 +79,45 @@ describe('AudienceRun bid adapter tests', function() {
76
79
  });
77
80
  });
78
81
 
79
- describe('buildRequests', function() {
82
+ describe('buildRequests', function () {
80
83
  const bidRequests = [
81
84
  {
82
- 'bidder': 'audiencerun',
83
- 'bidId': '51ef8751f9aead',
84
- 'params': {
85
- 'zoneId': '12345abcde'
85
+ bidder: 'audiencerun',
86
+ bidId: '51ef8751f9aead',
87
+ params: {
88
+ zoneId: '12345abcde',
86
89
  },
87
- 'adUnitCode': 'div-gpt-ad-1460505748561-0',
88
- 'transactionId': 'd7b773de-ceaa-484d-89ca-d9f51b8d61ec',
89
- 'mediaTypes': {
90
- 'banner': {
91
- 'sizes': [[320, 50], [300, 250], [300, 600]]
92
- }
90
+ adUnitCode: 'div-gpt-ad-1460505748561-0',
91
+ transactionId: 'd7b773de-ceaa-484d-89ca-d9f51b8d61ec',
92
+ mediaTypes: {
93
+ banner: {
94
+ sizes: [
95
+ [320, 50],
96
+ [300, 250],
97
+ [300, 600],
98
+ ],
99
+ },
93
100
  },
94
- 'bidderRequestId': '418b37f85e772c',
95
- 'auctionId': '18fd8b8b0bd757',
96
- 'bidRequestsCount': 1
97
- }
101
+ bidderRequestId: '418b37f85e772c',
102
+ auctionId: '18fd8b8b0bd757',
103
+ bidRequestsCount: 1,
104
+ },
98
105
  ];
99
106
  const bidRequest = bidRequests[0];
100
107
 
101
- it('sends a valid bid request to ENDPOINT via POST', function() {
108
+ it('sends a valid bid request to ENDPOINT via POST', function () {
102
109
  const request = spec.buildRequests(bidRequests, {
103
110
  gdprConsent: {
104
- consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
105
- gdprApplies: true
111
+ consentString:
112
+ 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
113
+ gdprApplies: true,
106
114
  },
107
115
  refererInfo: {
108
- canonicalUrl: 'https://example.com/canonical',
109
- referer: 'https://example.com'
110
- }
116
+ canonicalUrl: undefined,
117
+ referer: 'https://example.com',
118
+ numIframes: 0,
119
+ reachedTop: true,
120
+ },
111
121
  });
112
122
 
113
123
  expect(request.url).to.equal(ENDPOINT);
@@ -116,7 +126,9 @@ describe('AudienceRun bid adapter tests', function() {
116
126
  const payload = JSON.parse(request.data);
117
127
  expect(payload.gdpr).to.exist;
118
128
 
119
- expect(payload.bids).to.exist.and.to.be.an('array').and.to.have.lengthOf(1);
129
+ expect(payload.bids)
130
+ .to.exist.and.to.be.an('array')
131
+ .and.to.have.lengthOf(1);
120
132
  expect(payload.referer).to.exist;
121
133
 
122
134
  const bid = payload.bids[0];
@@ -128,13 +140,13 @@ describe('AudienceRun bid adapter tests', function() {
128
140
  expect(bid.sizes[0].h).to.be.a('number');
129
141
  });
130
142
 
131
- it('should send GDPR to endpoint and honor gdprApplies value', function() {
143
+ it('should send GDPR to endpoint and honor gdprApplies value', function () {
132
144
  let consentString = 'bogusConsent';
133
145
  let bidderRequest = {
134
- 'gdprConsent': {
135
- 'consentString': consentString,
136
- 'gdprApplies': true
137
- }
146
+ gdprConsent: {
147
+ consentString: consentString,
148
+ gdprApplies: true,
149
+ },
138
150
  };
139
151
 
140
152
  const request = spec.buildRequests(bidRequests, bidderRequest);
@@ -144,10 +156,10 @@ describe('AudienceRun bid adapter tests', function() {
144
156
  expect(payload.gdpr.applies).to.equal(true);
145
157
 
146
158
  let bidderRequest2 = {
147
- 'gdprConsent': {
148
- 'consentString': consentString,
149
- 'gdprApplies': false
150
- }
159
+ gdprConsent: {
160
+ consentString: consentString,
161
+ gdprApplies: false,
162
+ },
151
163
  };
152
164
 
153
165
  const request2 = spec.buildRequests(bidRequests, bidderRequest2);
@@ -158,19 +170,32 @@ describe('AudienceRun bid adapter tests', function() {
158
170
  expect(payload2.gdpr.applies).to.equal(false);
159
171
  });
160
172
 
161
- it('should use a bidfloor with a 0 value', function() {
173
+ it('should use the auctionUrl passed from bid params', function () {
174
+ const bid = Object.assign({}, bidRequest, {
175
+ params: {
176
+ zoneId: '12345abcde',
177
+ auctionUrl: 'https://auction.url.audiencerun.com',
178
+ },
179
+ });
180
+ const request = spec.buildRequests([bid]);
181
+
182
+ expect(request.url).to.exist;
183
+ expect(request.url).to.equal('https://auction.url.audiencerun.com');
184
+ });
185
+
186
+ it('should use a bidfloor with a 0 value', function () {
162
187
  const bid = Object.assign({}, bidRequest);
163
188
  const request = spec.buildRequests([bid]);
164
189
  const payload = JSON.parse(request.data);
165
190
  expect(payload.bids[0].bidfloor).to.exist.and.to.equal(0);
166
- })
191
+ });
167
192
 
168
193
  it('should use bidfloor param value', function () {
169
194
  const bid = Object.assign({}, bidRequest, {
170
195
  params: {
171
- 'bidfloor': 0.2
172
- }
173
- })
196
+ bidfloor: 0.2,
197
+ },
198
+ });
174
199
  const request = spec.buildRequests([bid]);
175
200
  const payload = JSON.parse(request.data);
176
201
  expect(payload.bids[0].bidfloor).to.exist.and.to.equal(0.2);
@@ -179,43 +204,104 @@ describe('AudienceRun bid adapter tests', function() {
179
204
  it('should use floors module value', function () {
180
205
  const bid = Object.assign({}, bidRequest, {
181
206
  params: {
182
- 'bidfloor': 0.5
183
- }
184
- })
207
+ bidfloor: 0.5,
208
+ },
209
+ });
185
210
  bid.getFloor = () => {
186
- return { floor: 1, currency: 'USD' }
187
- }
211
+ return { floor: 1, currency: 'USD' };
212
+ };
188
213
  const request = spec.buildRequests([bid]);
189
214
  const payload = JSON.parse(request.data);
190
215
  expect(payload.bids[0].bidfloor).to.exist.and.to.equal(1);
191
216
  });
217
+
218
+ it('should add userid eids information to the request', function () {
219
+ const bid = Object.assign({}, bidRequest);
220
+ bid.userId = {
221
+ pubcid: '01EAJWWNEPN3CYMM5N8M5VXY22',
222
+ unsuported: '666',
223
+ }
224
+
225
+ const request = spec.buildRequests([bid]);
226
+ const payload = JSON.parse(request.data);
227
+
228
+ expect(payload.userId).to.exist;
229
+ expect(payload.userId).to.deep.equal([
230
+ {
231
+ source: 'pubcid.org',
232
+ uids: [
233
+ {
234
+ atype: 1,
235
+ id: '01EAJWWNEPN3CYMM5N8M5VXY22',
236
+ },
237
+ ],
238
+ },
239
+ ]);
240
+ });
241
+
242
+ it('should add schain object if available', function() {
243
+ const bid = Object.assign({}, bidRequest)
244
+ bid.schain = {
245
+ ver: '1.0',
246
+ complete: 1,
247
+ nodes: [
248
+ {
249
+ asi: 'directseller.com',
250
+ sid: '00001',
251
+ rid: 'BidRequest1',
252
+ hp: 1,
253
+ },
254
+ ],
255
+ };
256
+
257
+ const request = spec.buildRequests([bid]);
258
+ const payload = JSON.parse(request.data);
259
+
260
+ expect(payload.schain).to.exist;
261
+ expect(payload.schain).to.deep.equal({
262
+ ver: '1.0',
263
+ complete: 1,
264
+ nodes: [
265
+ {
266
+ asi: 'directseller.com',
267
+ sid: '00001',
268
+ rid: 'BidRequest1',
269
+ hp: 1,
270
+ },
271
+ ],
272
+ });
273
+ })
192
274
  });
193
275
 
194
276
  describe('interpretResponse', function () {
195
- const expectedResponse = [{
196
- 'requestId': '51ef8751f9aead',
197
- 'cpm': 8.021951999999999999,
198
- 'width': '728',
199
- 'height': '90',
200
- 'creativeId': '5678',
201
- 'currency': 'USD',
202
- 'netRevenue': false,
203
- 'ttl': 300,
204
- 'ad': '<!-- test creative -->',
205
- 'mediaType': 'banner',
206
- 'meta': {
207
- 'advertiserDomains': ['example.com']
208
- }
209
- }];
277
+ const expectedResponse = [
278
+ {
279
+ requestId: '51ef8751f9aead',
280
+ cpm: 8.0219519,
281
+ width: '728',
282
+ height: '90',
283
+ creativeId: '5678',
284
+ currency: 'USD',
285
+ netRevenue: false,
286
+ ttl: 300,
287
+ ad: '<!-- test creative -->',
288
+ mediaType: 'banner',
289
+ meta: {
290
+ advertiserDomains: ['example.com'],
291
+ },
292
+ },
293
+ ];
210
294
 
211
295
  it('should get the correct bid response by display ad', function () {
212
296
  let result = spec.interpretResponse(BID_SERVER_RESPONSE);
213
- expect(Object.keys(result[0])).to.have.members(Object.keys(expectedResponse[0]));
297
+ expect(Object.keys(result[0])).to.have.members(
298
+ Object.keys(expectedResponse[0])
299
+ );
214
300
  });
215
301
 
216
302
  it('should handle empty bid response', function () {
217
303
  const response = {
218
- body: {}
304
+ body: {},
219
305
  };
220
306
  let result = spec.interpretResponse(response);
221
307
  expect(result.length).to.equal(0);
@@ -223,17 +309,19 @@ describe('AudienceRun bid adapter tests', function() {
223
309
  });
224
310
 
225
311
  describe('getUserSyncs', function () {
226
- const serverResponses = [ BID_SERVER_RESPONSE ];
312
+ const serverResponses = [BID_SERVER_RESPONSE];
227
313
  const syncOptions = { iframeEnabled: true };
228
314
 
229
- it('should return empty if no server responses', function() {
315
+ it('should return empty if no server responses', function () {
230
316
  const syncs = spec.getUserSyncs(syncOptions, []);
231
- expect(syncs).to.deep.equal([])
317
+ expect(syncs).to.deep.equal([]);
232
318
  });
233
319
 
234
320
  it('should return user syncs', function () {
235
321
  const syncs = spec.getUserSyncs(syncOptions, serverResponses);
236
- expect(syncs).to.deep.equal([{type: 'iframe', url: 'https://ac.audiencerun.com/f/sync.html'}])
322
+ expect(syncs).to.deep.equal([
323
+ { type: 'iframe', url: 'https://ac.audiencerun.com/f/sync.html' },
324
+ ]);
237
325
  });
238
326
  });
239
327
 
@@ -3,7 +3,7 @@ import { spec } from 'modules/cointrafficBidAdapter.js';
3
3
  import { config } from 'src/config.js'
4
4
  import * as utils from 'src/utils.js'
5
5
 
6
- const ENDPOINT_URL = 'https://appspb.cointraffic.io/pb/tmp';
6
+ const ENDPOINT_URL = 'https://apps-pbd.ctengine.io/pb/tmp';
7
7
 
8
8
  describe('cointrafficBidAdapter', function () {
9
9
  describe('isBidRequestValid', function () {
@@ -48,6 +48,10 @@ describe('ColossussspAdapter', function () {
48
48
  auctionStart: 1472239426000,
49
49
  timeout: 5000,
50
50
  uspConsent: '1YN-',
51
+ gdprConsent: {
52
+ consentString: 'xxx',
53
+ gdprApplies: 1
54
+ },
51
55
  refererInfo: {
52
56
  referer: 'http://www.example.com',
53
57
  reachedTop: true,
@@ -87,7 +91,7 @@ describe('ColossussspAdapter', function () {
87
91
  it('Returns valid data if array of bids is valid', function () {
88
92
  let data = serverRequest.data;
89
93
  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');
91
95
  expect(data.deviceWidth).to.be.a('number');
92
96
  expect(data.deviceHeight).to.be.a('number');
93
97
  expect(data.language).to.be.a('string');
@@ -108,6 +112,53 @@ describe('ColossussspAdapter', function () {
108
112
  expect(placement.gpid).to.be.an('string');
109
113
  }
110
114
  });
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
+
111
162
  it('Returns empty data if no valid requests are passed', function () {
112
163
  serverRequest = spec.buildRequests([], bidderRequest);
113
164
  let data = serverRequest.data;
@@ -187,6 +238,49 @@ describe('ColossussspAdapter', function () {
187
238
  expect(serverResponses).to.be.an('array').that.is.empty;
188
239
  });
189
240
  });
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
+ });
190
284
  });
191
285
 
192
286
  describe('onBidWon', function () {
@@ -199,13 +293,13 @@ describe('ColossussspAdapter', function () {
199
293
  })
200
294
 
201
295
  describe('getUserSyncs', function () {
202
- let userSync = spec.getUserSyncs({}, {}, {}, {});
296
+ let userSync = spec.getUserSyncs({}, {}, { consentString: 'xxx', gdprApplies: 1 }, { consentString: '1YN-' });
203
297
  it('Returns valid URL and type', function () {
204
298
  expect(userSync).to.be.an('array').with.lengthOf(1);
205
299
  expect(userSync[0].type).to.exist;
206
300
  expect(userSync[0].url).to.exist;
207
301
  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');
209
303
  });
210
304
  });
211
305
  });
@@ -140,6 +140,7 @@ describe('consentManagement', function () {
140
140
  setConsentConfig(staticConfig);
141
141
  expect(consentAPI).to.be.equal('static');
142
142
  expect(consentTimeout).to.be.equal(0); // should always return without a timeout when config is used
143
+ expect(uspDataHandler.getConsentData()).to.eql(staticConfig.usp.consentData.getUSPData.uspString)
143
144
  expect(staticConsentData.usPrivacy).to.be.equal(staticConfig.usp.consentData.getUSPData.uspString);
144
145
  });
145
146
  });
@@ -281,6 +281,9 @@ describe('consentManagement', function () {
281
281
  definedInConfig: true
282
282
  });
283
283
  expect(gdprScope).to.be.equal(false);
284
+ const consent = gdprDataHandler.getConsentData();
285
+ expect(consent.consentString).to.eql(staticConfig.consentData.getTCData.tcString);
286
+ expect(consent.vendorData).to.eql(staticConfig.consentData.getTCData);
284
287
  expect(staticConsentData).to.be.equal(staticConfig.consentData);
285
288
  });
286
289
  });
@@ -299,6 +302,14 @@ describe('consentManagement', function () {
299
302
  allowAuctionWithoutConsent: true
300
303
  };
301
304
 
305
+ const staticConfig = {
306
+ cmpApi: 'static',
307
+ timeout: 7500,
308
+ consentData: {
309
+ getTCData: {}
310
+ }
311
+ }
312
+
302
313
  let didHookReturn;
303
314
 
304
315
  afterEach(function () {
@@ -357,6 +368,17 @@ describe('consentManagement', function () {
357
368
  expect(consent).to.be.null;
358
369
  expect(gdprDataHandler.ready).to.be.true;
359
370
  });
371
+
372
+ it('should not trip when adUnits have no size', () => {
373
+ setConsentConfig(staticConfig);
374
+ let ran = false;
375
+ requestBidsHook(() => {
376
+ ran = true;
377
+ }, {adUnits: [{code: 'test', mediaTypes: {video: {}}}]});
378
+ return gdprDataHandler.promise.then(() => {
379
+ expect(ran).to.be.true;
380
+ });
381
+ })
360
382
  });
361
383
 
362
384
  describe('already known consentData:', function () {