prebid.js 8.6.0 → 8.7.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 (162) hide show
  1. package/dist/33acrossBidAdapter.js +1 -1
  2. package/dist/33acrossIdSystem.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/adqueryBidAdapter.js +1 -1
  7. package/dist/adrelevantisBidAdapter.js +1 -1
  8. package/dist/adsinteractiveBidAdapter.js +1 -1
  9. package/dist/adtrgtmeBidAdapter.js +1 -1
  10. package/dist/adxcgBidAdapter.js +1 -1
  11. package/dist/adyoulikeBidAdapter.js +1 -1
  12. package/dist/ajaBidAdapter.js +1 -1
  13. package/dist/alkimiBidAdapter.js +1 -1
  14. package/dist/amxBidAdapter.js +1 -1
  15. package/dist/amxIdSystem.js +1 -1
  16. package/dist/appierAnalyticsAdapter.js +1 -1
  17. package/dist/appnexusBidAdapter.js +1 -1
  18. package/dist/asoBidAdapter.js +1 -1
  19. package/dist/automatadAnalyticsAdapter.js +1 -0
  20. package/dist/axonixBidAdapter.js +1 -1
  21. package/dist/bidglassBidAdapter.js +1 -1
  22. package/dist/big-richmediaBidAdapter.js +1 -1
  23. package/dist/bridBidAdapter.js +1 -1
  24. package/dist/bridgewellBidAdapter.js +1 -1
  25. package/dist/brightMountainMediaBidAdapter.js +1 -1
  26. package/dist/carodaBidAdapter.js +1 -1
  27. package/dist/chtnwBidAdapter.js +1 -1
  28. package/dist/concertBidAdapter.js +1 -1
  29. package/dist/connatixBidAdapter.js +1 -0
  30. package/dist/connectadBidAdapter.js +1 -1
  31. package/dist/consumableBidAdapter.js +1 -1
  32. package/dist/conversantAnalyticsAdapter.js +1 -1
  33. package/dist/conversantBidAdapter.js +1 -1
  34. package/dist/craftBidAdapter.js +1 -1
  35. package/dist/criteoBidAdapter.js +1 -1
  36. package/dist/cwireBidAdapter.js +1 -1
  37. package/dist/dependencies.json +3 -0
  38. package/dist/dspxBidAdapter.js +1 -1
  39. package/dist/eplanningBidAdapter.js +1 -1
  40. package/dist/euidIdSystem.js +1 -1
  41. package/dist/feedadBidAdapter.js +1 -1
  42. package/dist/finativeBidAdapter.js +1 -1
  43. package/dist/freepassBidAdapter.js +1 -1
  44. package/dist/freewheel-sspBidAdapter.js +1 -1
  45. package/dist/gmosspBidAdapter.js +1 -1
  46. package/dist/goldbachBidAdapter.js +1 -1
  47. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  48. package/dist/greenbidsRtdProvider.js +1 -1
  49. package/dist/gridBidAdapter.js +1 -1
  50. package/dist/gumgumBidAdapter.js +1 -1
  51. package/dist/h12mediaBidAdapter.js +1 -1
  52. package/dist/hypelabBidAdapter.js +1 -1
  53. package/dist/id5IdSystem.js +1 -1
  54. package/dist/imdsBidAdapter.js +1 -1
  55. package/dist/improvedigitalBidAdapter.js +1 -1
  56. package/dist/insticatorBidAdapter.js +1 -1
  57. package/dist/ixBidAdapter.js +1 -1
  58. package/dist/justpremiumBidAdapter.js +1 -1
  59. package/dist/kargoBidAdapter.js +1 -1
  60. package/dist/konduitAnalyticsAdapter.js +1 -1
  61. package/dist/kueezBidAdapter.js +1 -1
  62. package/dist/kueezRtbBidAdapter.js +1 -1
  63. package/dist/kulturemediaBidAdapter.js +1 -1
  64. package/dist/lassoBidAdapter.js +1 -1
  65. package/dist/lifestreetBidAdapter.js +1 -1
  66. package/dist/logicadBidAdapter.js +1 -1
  67. package/dist/loglyliftBidAdapter.js +1 -1
  68. package/dist/magniteAnalyticsAdapter.js +1 -1
  69. package/dist/malltvAnalyticsAdapter.js +1 -1
  70. package/dist/marsmediaBidAdapter.js +1 -1
  71. package/dist/mediafuseBidAdapter.js +1 -1
  72. package/dist/medianetBidAdapter.js +1 -1
  73. package/dist/mediasquareBidAdapter.js +1 -1
  74. package/dist/mgidBidAdapter.js +1 -1
  75. package/dist/minutemediaBidAdapter.js +1 -1
  76. package/dist/minutemediaplusBidAdapter.js +1 -1
  77. package/dist/nexx360BidAdapter.js +1 -1
  78. package/dist/not-for-prod/prebid.js +131 -129
  79. package/dist/oguryBidAdapter.js +1 -1
  80. package/dist/onetagBidAdapter.js +1 -1
  81. package/dist/ooloAnalyticsAdapter.js +1 -1
  82. package/dist/optidigitalBidAdapter.js +1 -1
  83. package/dist/outbrainBidAdapter.js +1 -1
  84. package/dist/parrableIdSystem.js +1 -1
  85. package/dist/pixfutureBidAdapter.js +1 -1
  86. package/dist/prebid-core.js +1 -1
  87. package/dist/publinkIdSystem.js +1 -1
  88. package/dist/pubmaticBidAdapter.js +1 -1
  89. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  90. package/dist/pxyzBidAdapter.js +1 -1
  91. package/dist/quantcastBidAdapter.js +1 -1
  92. package/dist/readpeakBidAdapter.js +1 -1
  93. package/dist/relaidoBidAdapter.js +1 -1
  94. package/dist/retailspotBidAdapter.js +1 -1
  95. package/dist/rhythmoneBidAdapter.js +1 -1
  96. package/dist/riseBidAdapter.js +1 -1
  97. package/dist/rubiconBidAdapter.js +1 -1
  98. package/dist/seedingAllianceBidAdapter.js +1 -1
  99. package/dist/seedtagBidAdapter.js +1 -1
  100. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  101. package/dist/sharethroughBidAdapter.js +1 -1
  102. package/dist/shinezBidAdapter.js +1 -1
  103. package/dist/smaatoBidAdapter.js +1 -1
  104. package/dist/smartadserverBidAdapter.js +1 -1
  105. package/dist/smartxBidAdapter.js +1 -1
  106. package/dist/smilewantedBidAdapter.js +1 -1
  107. package/dist/sonobiBidAdapter.js +1 -1
  108. package/dist/sovrnAnalyticsAdapter.js +1 -1
  109. package/dist/sovrnBidAdapter.js +1 -1
  110. package/dist/sspBCBidAdapter.js +1 -1
  111. package/dist/stvBidAdapter.js +1 -1
  112. package/dist/sublimeBidAdapter.js +1 -1
  113. package/dist/tappxBidAdapter.js +1 -1
  114. package/dist/targetVideoBidAdapter.js +1 -1
  115. package/dist/teadsBidAdapter.js +1 -1
  116. package/dist/trionBidAdapter.js +1 -1
  117. package/dist/tripleliftBidAdapter.js +1 -1
  118. package/dist/ttdBidAdapter.js +1 -1
  119. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  120. package/dist/uid2IdSystem.js +1 -1
  121. package/dist/underdogmediaBidAdapter.js +1 -1
  122. package/dist/undertoneBidAdapter.js +1 -1
  123. package/dist/vidazooBidAdapter.js +1 -1
  124. package/dist/videobyteBidAdapter.js +1 -1
  125. package/dist/visxBidAdapter.js +1 -1
  126. package/dist/vuukleBidAdapter.js +1 -1
  127. package/dist/widespaceBidAdapter.js +1 -1
  128. package/dist/winrBidAdapter.js +1 -1
  129. package/dist/yahoosspBidAdapter.js +1 -1
  130. package/dist/yieldmoBidAdapter.js +1 -1
  131. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  132. package/modules/adagioBidAdapter.js +15 -1
  133. package/modules/adgenerationBidAdapter.js +4 -3
  134. package/modules/adsinteractiveBidAdapter.js +2 -0
  135. package/modules/alkimiBidAdapter.js +19 -7
  136. package/modules/automatadAnalyticsAdapter.js +325 -0
  137. package/modules/automatadAnalyticsAdapter.md +23 -0
  138. package/modules/connatixBidAdapter.js +185 -0
  139. package/modules/connatixBidAdapter.md +37 -0
  140. package/modules/criteoBidAdapter.js +7 -7
  141. package/modules/freepassBidAdapter.js +20 -1
  142. package/modules/freepassBidAdapter.md +4 -1
  143. package/modules/gridBidAdapter.js +1 -8
  144. package/modules/medianetBidAdapter.js +7 -4
  145. package/modules/mediasquareBidAdapter.js +3 -0
  146. package/modules/optidigitalBidAdapter.js +25 -16
  147. package/modules/tappxBidAdapter.js +17 -14
  148. package/modules/undertoneBidAdapter.md +1 -1
  149. package/modules/userId/eids.md +7 -0
  150. package/package.json +1 -1
  151. package/test/spec/modules/adagioBidAdapter_spec.js +89 -0
  152. package/test/spec/modules/adgenerationBidAdapter_spec.js +6 -6
  153. package/test/spec/modules/alkimiBidAdapter_spec.js +3 -9
  154. package/test/spec/modules/automatadAnalyticsAdapter_spec.js +533 -0
  155. package/test/spec/modules/connatixBidAdapter_spec.js +366 -0
  156. package/test/spec/modules/criteoBidAdapter_spec.js +21 -0
  157. package/test/spec/modules/freepassBidAdapter_spec.js +44 -0
  158. package/test/spec/modules/gridBidAdapter_spec.js +68 -0
  159. package/test/spec/modules/medianetBidAdapter_spec.js +18 -18
  160. package/test/spec/modules/mediasquareBidAdapter_spec.js +5 -0
  161. package/test/spec/modules/optidigitalBidAdapter_spec.js +9 -2
  162. package/test/spec/modules/tappxBidAdapter_spec.js +19 -0
@@ -0,0 +1,366 @@
1
+ import { expect } from 'chai';
2
+ import {
3
+ spec,
4
+ getBidFloor as connatixGetBidFloor
5
+ } from '../../../modules/connatixBidAdapter.js';
6
+ import { BANNER } from '../../../src/mediaTypes.js';
7
+
8
+ describe('connatixBidAdapter', function () {
9
+ let bid;
10
+
11
+ function mockBidRequest() {
12
+ const mediaTypes = {
13
+ banner: {
14
+ sizes: [16, 9],
15
+ }
16
+ };
17
+ return {
18
+ bidId: 'testing',
19
+ bidder: 'connatix',
20
+ params: {
21
+ placementId: '30e91414-545c-4f45-a950-0bec9308ff22'
22
+ },
23
+ mediaTypes
24
+ };
25
+ };
26
+
27
+ describe('isBidRequestValid', function () {
28
+ this.beforeEach(function () {
29
+ bid = mockBidRequest();
30
+ });
31
+
32
+ it('Should return true if all required fileds are present', function () {
33
+ expect(spec.isBidRequestValid(bid)).to.be.true;
34
+ });
35
+ it('Should return false if bidder does not correspond', function () {
36
+ bid.bidder = 'abc';
37
+ expect(spec.isBidRequestValid(bid)).to.be.false;
38
+ });
39
+ it('Should return false if bidId is missing', function () {
40
+ delete bid.bidId;
41
+ expect(spec.isBidRequestValid(bid)).to.be.false;
42
+ });
43
+ it('Should return false if params object is missing', function () {
44
+ delete bid.params;
45
+ expect(spec.isBidRequestValid(bid)).to.be.false;
46
+ });
47
+ it('Should return false if placementId is missing from params', function () {
48
+ delete bid.params.placementId;
49
+ expect(spec.isBidRequestValid(bid)).to.be.false;
50
+ });
51
+ it('Should return false if mediaTypes is missing', function () {
52
+ delete bid.mediaTypes;
53
+ expect(spec.isBidRequestValid(bid)).to.be.false;
54
+ });
55
+ it('Should return false if banner is missing from mediaTypes ', function () {
56
+ delete bid.mediaTypes.banner;
57
+ expect(spec.isBidRequestValid(bid)).to.be.false;
58
+ });
59
+ it('Should return false if sizes is missing from banner object', function () {
60
+ delete bid.mediaTypes.banner.sizes;
61
+ expect(spec.isBidRequestValid(bid)).to.be.false;
62
+ });
63
+ it('Should return false if sizes is not an array', function () {
64
+ bid.mediaTypes.banner.sizes = 'test';
65
+ expect(spec.isBidRequestValid(bid)).to.be.false;
66
+ });
67
+ it('Should return false if sizes is an empty array', function () {
68
+ bid.mediaTypes.banner.sizes = [];
69
+ expect(spec.isBidRequestValid(bid)).to.be.false;
70
+ });
71
+ it('Should return true if add an extra field was added to the bidRequest', function () {
72
+ bid.params.test = 1;
73
+ expect(spec.isBidRequestValid(bid)).to.be.true;
74
+ });
75
+ });
76
+
77
+ describe('buildRequests', function () {
78
+ let serverRequest;
79
+ let bidderRequest = {
80
+ refererInfo: {
81
+ canonicalUrl: '',
82
+ numIframes: 0,
83
+ reachedTop: true,
84
+ referer: 'http://example.com',
85
+ stack: ['http://example.com']
86
+ },
87
+ gdprConsent: {
88
+ consentString: 'BOJ/P2HOJ/P2HABABMAAAAAZ+A==',
89
+ vendorData: {},
90
+ gdprApplies: true
91
+ },
92
+ uspConsent: '1YYY',
93
+ ortb2: {
94
+ site: {
95
+ data: {
96
+ pageType: 'article'
97
+ }
98
+ }
99
+ }
100
+ };
101
+
102
+ this.beforeEach(function () {
103
+ bid = mockBidRequest();
104
+ serverRequest = spec.buildRequests([bid], bidderRequest);
105
+ })
106
+
107
+ it('Creates a ServerRequest object with method, URL and data', function () {
108
+ expect(serverRequest).to.exist;
109
+ expect(serverRequest.method).to.exist;
110
+ expect(serverRequest.url).to.exist;
111
+ expect(serverRequest.data).to.exist;
112
+ });
113
+ it('Returns POST method', function () {
114
+ expect(serverRequest.method).to.equal('POST');
115
+ });
116
+ it('Returns valid URL', function () {
117
+ expect(serverRequest.url).to.equal('https://capi.connatix.com/rtb/hba');
118
+ });
119
+ it('Returns request payload', function () {
120
+ expect(serverRequest.data).to.not.empty;
121
+ });
122
+ it('Validate request payload', function () {
123
+ expect(serverRequest.data.bidRequests[0].bidId).to.equal(bid.bidId);
124
+ expect(serverRequest.data.bidRequests[0].placementId).to.equal(bid.params.placementId);
125
+ expect(serverRequest.data.bidRequests[0].floor).to.equal(0);
126
+ expect(serverRequest.data.bidRequests[0].mediaTypes).to.equal(bid.mediaTypes);
127
+ expect(serverRequest.data.bidRequests[0].sizes).to.equal(bid.mediaTypes.sizes);
128
+ expect(serverRequest.data.refererInfo).to.equal(bidderRequest.refererInfo);
129
+ expect(serverRequest.data.gdprConsent).to.equal(bidderRequest.gdprConsent);
130
+ expect(serverRequest.data.uspConsent).to.equal(bidderRequest.uspConsent);
131
+ expect(serverRequest.data.ortb2).to.equal(bidderRequest.ortb2);
132
+ });
133
+ });
134
+
135
+ describe('interpretResponse', function () {
136
+ const CustomerId = '99f20d18-c4b4-4a28-3d8e-d43e2c8cb4ac';
137
+ const PlayerId = 'e4984e88-9ff4-45a3-8b9d-33aabcad634f';
138
+ const Bid = {Cpm: 0.1, LineItems: [], RequestId: '2f897340c4eaa3', Ttl: 86400};
139
+
140
+ let serverResponse;
141
+ this.beforeEach(function () {
142
+ serverResponse = {
143
+ body: {
144
+ CustomerId,
145
+ PlayerId,
146
+ Bids: [ Bid ]
147
+ },
148
+ headers: function() { }
149
+ };
150
+ });
151
+
152
+ it('Should return an empty array if Bids is null', function () {
153
+ serverResponse.body.Bids = null;
154
+
155
+ const response = spec.interpretResponse(serverResponse);
156
+ expect(response).to.be.an('array').that.is.empty;
157
+ });
158
+
159
+ it('Should return an empty array if Bids is empty array', function () {
160
+ serverResponse.body.Bids = [];
161
+ const response = spec.interpretResponse(serverResponse);
162
+ expect(response).to.be.an('array').that.is.empty;
163
+ });
164
+
165
+ it('Should return an empty array if CustomerId is null', function () {
166
+ serverResponse.body.CustomerId = null;
167
+ const response = spec.interpretResponse(serverResponse);
168
+ expect(response).to.be.an('array').that.is.empty;
169
+ });
170
+
171
+ it('Should return an empty array if PlayerId is null', function () {
172
+ serverResponse.body.PlayerId = null;
173
+ const response = spec.interpretResponse(serverResponse);
174
+ expect(response).to.be.an('array').that.is.empty;
175
+ });
176
+
177
+ it('Should return one bid response for one bid', function() {
178
+ const bidResponses = spec.interpretResponse(serverResponse);
179
+ expect(bidResponses.length).to.equal(1);
180
+ });
181
+
182
+ it('Should contains the same values as in the serverResponse', function() {
183
+ const bidResponses = spec.interpretResponse(serverResponse);
184
+
185
+ const [ bidResponse ] = bidResponses;
186
+ expect(bidResponse.requestId).to.equal(serverResponse.body.Bids[0].RequestId);
187
+ expect(bidResponse.cpm).to.equal(serverResponse.body.Bids[0].Cpm);
188
+ expect(bidResponse.ttl).to.equal(serverResponse.body.Bids[0].Ttl);
189
+ expect(bidResponse.currency).to.equal('USD');
190
+ expect(bidResponse.mediaType).to.equal(BANNER);
191
+ expect(bidResponse.netRevenue).to.be.true;
192
+ });
193
+
194
+ it('Should return n bid responses for n bids', function() {
195
+ serverResponse.body.Bids = [ { ...Bid }, { ...Bid } ];
196
+
197
+ const firstBidCpm = 4;
198
+ serverResponse.body.Bids[0].Cpm = firstBidCpm;
199
+
200
+ const secondBidCpm = 13;
201
+ serverResponse.body.Bids[1].Cpm = secondBidCpm;
202
+
203
+ const bidResponses = spec.interpretResponse(serverResponse);
204
+ expect(bidResponses.length).to.equal(2);
205
+
206
+ expect(bidResponses[0].cpm).to.equal(firstBidCpm);
207
+ expect(bidResponses[1].cpm).to.equal(secondBidCpm);
208
+ });
209
+ });
210
+
211
+ describe('getUserSyncs', function() {
212
+ const CustomerId = '99f20d18-c4b4-4a28-3d8e-d43e2c8cb4ac';
213
+ const PlayerId = 'e4984e88-9ff4-45a3-8b9d-33aabcad634f';
214
+ const UserSyncEndpoint = 'https://connatix.com/sync'
215
+ const Bid = {Cpm: 0.1, LineItems: [], RequestId: '2f897340c4eaa3', Ttl: 86400};
216
+
217
+ const serverResponse = {
218
+ body: {
219
+ CustomerId,
220
+ PlayerId,
221
+ UserSyncEndpoint,
222
+ Bids: [ Bid ]
223
+ },
224
+ headers: function() { }
225
+ };
226
+
227
+ it('Should return an empty array when iframeEnabled: false', function () {
228
+ expect(spec.getUserSyncs({iframeEnabled: false, pixelEnabled: true}, [], {}, {}, {})).to.be.an('array').that.is.empty;
229
+ });
230
+ it('Should return an empty array when serverResponses is emprt array', function () {
231
+ expect(spec.getUserSyncs({iframeEnabled: true, pixelEnabled: true}, [], {}, {}, {})).to.be.an('array').that.is.empty;
232
+ });
233
+ it('Should return an empty array when iframeEnabled: true but serverResponses in an empty array', function () {
234
+ expect(spec.getUserSyncs({iframeEnabled: false, pixelEnabled: true}, [serverResponse], {}, {}, {})).to.be.an('array').that.is.empty;
235
+ });
236
+ it('Should return an empty array when iframeEnabled: true but serverResponses in an not defined or null', function () {
237
+ expect(spec.getUserSyncs({iframeEnabled: false, pixelEnabled: true}, undefined, {}, {}, {})).to.be.an('array').that.is.empty;
238
+ expect(spec.getUserSyncs({iframeEnabled: false, pixelEnabled: true}, null, {}, {}, {})).to.be.an('array').that.is.empty;
239
+ });
240
+ it('Should return one user sync object when iframeEnabled is true and serverResponses is not an empry array', function () {
241
+ expect(spec.getUserSyncs({iframeEnabled: true, pixelEnabled: true}, [serverResponse], {}, {}, {})).to.be.an('array').that.is.not.empty;
242
+ });
243
+ it('Should return a list containing a single object having type: iframe and url: syncUrl', function () {
244
+ const userSyncList = spec.getUserSyncs({iframeEnabled: true, pixelEnabled: true}, [serverResponse], undefined, undefined, undefined);
245
+ const { type, url } = userSyncList[0];
246
+ expect(type).to.equal('iframe');
247
+ expect(url).to.equal(UserSyncEndpoint);
248
+ });
249
+ it('Should append gdpr: 0 if gdprConsent object is provided but gdprApplies field is not provided', function () {
250
+ const userSyncList = spec.getUserSyncs(
251
+ {iframeEnabled: true, pixelEnabled: true},
252
+ [serverResponse],
253
+ {},
254
+ undefined,
255
+ undefined
256
+ );
257
+ const { url } = userSyncList[0];
258
+ expect(url).to.equal(`${UserSyncEndpoint}?gdpr=0`);
259
+ });
260
+ it('Should append gdpr having the value of gdprApplied if gdprConsent object is present and have gdprApplies field', function () {
261
+ const userSyncList = spec.getUserSyncs(
262
+ {iframeEnabled: true, pixelEnabled: true},
263
+ [serverResponse],
264
+ {gdprApplies: true},
265
+ undefined,
266
+ undefined
267
+ );
268
+ const { url } = userSyncList[0];
269
+ expect(url).to.equal(`${UserSyncEndpoint}?gdpr=1`);
270
+ });
271
+ it('Should append gdpr_consent if gdprConsent object is present and have gdprApplies field', function () {
272
+ const userSyncList = spec.getUserSyncs(
273
+ {iframeEnabled: true, pixelEnabled: true},
274
+ [serverResponse],
275
+ {gdprApplies: true, consentString: 'alabala'},
276
+ undefined,
277
+ undefined
278
+ );
279
+ const { url } = userSyncList[0];
280
+ expect(url).to.equal(`${UserSyncEndpoint}?gdpr=1&gdpr_consent=alabala`);
281
+ });
282
+ it('Should encodeURI gdpr_consent corectly', function () {
283
+ const userSyncList = spec.getUserSyncs(
284
+ {iframeEnabled: true, pixelEnabled: true},
285
+ [serverResponse],
286
+ {gdprApplies: true, consentString: 'test&2'},
287
+ undefined,
288
+ undefined
289
+ );
290
+ const { url } = userSyncList[0];
291
+ expect(url).to.equal(`${UserSyncEndpoint}?gdpr=1&gdpr_consent=test%262`);
292
+ });
293
+ it('Should append usp_consent to the url if uspConsent is provided', function () {
294
+ const userSyncList = spec.getUserSyncs(
295
+ {iframeEnabled: true, pixelEnabled: true},
296
+ [serverResponse],
297
+ {gdprApplies: true, consentString: 'test&2'},
298
+ '1YYYN',
299
+ undefined
300
+ );
301
+ const { url } = userSyncList[0];
302
+ expect(url).to.equal(`${UserSyncEndpoint}?gdpr=1&gdpr_consent=test%262&us_privacy=1YYYN`);
303
+ });
304
+ it('Should not modify the sync url if gppConsent param is provided', function () {
305
+ const userSyncList = spec.getUserSyncs(
306
+ {iframeEnabled: true, pixelEnabled: true},
307
+ [serverResponse],
308
+ {gdprApplies: true, consentString: 'test&2'},
309
+ '1YYYN',
310
+ {consent: '1'}
311
+ );
312
+ const { url } = userSyncList[0];
313
+ expect(url).to.equal(`${UserSyncEndpoint}?gdpr=1&gdpr_consent=test%262&us_privacy=1YYYN`);
314
+ });
315
+ });
316
+
317
+ describe('getBidFloor', function () {
318
+ this.beforeEach(function () {
319
+ bid = mockBidRequest();
320
+ });
321
+
322
+ it('Should return 0 if both getFloor method and bidfloor param from bid are absent.', function () {
323
+ const floor = connatixGetBidFloor(bid);
324
+ expect(floor).to.equal(0);
325
+ });
326
+
327
+ it('Should return the value of the bidfloor parameter if the getFloor method is not defined but the bidfloor parameter is defined', function () {
328
+ const floorValue = 3;
329
+ bid.params.bidfloor = floorValue;
330
+
331
+ const floor = connatixGetBidFloor(bid);
332
+ expect(floor).to.equal(floorValue);
333
+ });
334
+
335
+ it('Should return the value of the getFloor method if the getFloor method is defined but the bidfloor parameter is not defined', function () {
336
+ const floorValue = 7;
337
+ bid.getFloor = function() {
338
+ return { floor: floorValue };
339
+ };
340
+
341
+ const floor = connatixGetBidFloor(bid);
342
+ expect(floor).to.equal(floorValue);
343
+ });
344
+
345
+ it('Should return the value of the getFloor method if both getFloor method and bidfloor parameter are defined', function () {
346
+ const floorParamValue = 3;
347
+ bid.params.bidfloor = floorParamValue;
348
+
349
+ const floorMethodValue = 7;
350
+ bid.getFloor = function() {
351
+ return { floor: floorMethodValue };
352
+ };
353
+
354
+ const floor = connatixGetBidFloor(bid);
355
+ expect(floor).to.equal(floorMethodValue);
356
+ });
357
+
358
+ it('Should return 0 if the getFloor method is defined and it crash when call it', function () {
359
+ bid.getFloor = function() {
360
+ throw new Error('error');
361
+ };
362
+ const floor = connatixGetBidFloor(bid);
363
+ expect(floor).to.equal(0);
364
+ });
365
+ });
366
+ });
@@ -217,15 +217,36 @@ describe('The Criteo bidding adapter', function () {
217
217
  }
218
218
  getCookieStub.callsFake(cookieName => cookieData[cookieName]);
219
219
  setCookieStub.callsFake((cookieName, value, expires) => cookieData[cookieName] = value);
220
+ getDataFromLocalStorageStub.callsFake(name => lsData[name]);
220
221
  removeDataFromLocalStorageStub.callsFake(name => lsData[name] = '');
221
222
  spec.onDataDeletionRequest([]);
222
223
  expect(getCookieStub.calledOnce).to.equal(true);
223
224
  expect(setCookieStub.calledOnce).to.equal(true);
225
+ expect(getDataFromLocalStorageStub.calledOnce).to.equal(true);
224
226
  expect(removeDataFromLocalStorageStub.calledOnce).to.equal(true);
225
227
  expect(cookieData.cto_bundle).to.equal('');
226
228
  expect(lsData.cto_bundle).to.equal('');
227
229
  expect(ajaxStub.calledOnce).to.equal(true);
228
230
  });
231
+
232
+ it('should not call API when calling onDataDeletionRequest with no id', () => {
233
+ const cookieData = {
234
+ 'cto_bundle': ''
235
+ };
236
+ const lsData = {
237
+ 'cto_bundle': ''
238
+ }
239
+ getCookieStub.callsFake(cookieName => cookieData[cookieName]);
240
+ setCookieStub.callsFake((cookieName, value, expires) => cookieData[cookieName] = value);
241
+ getDataFromLocalStorageStub.callsFake(name => lsData[name]);
242
+ removeDataFromLocalStorageStub.callsFake(name => lsData[name] = '');
243
+ spec.onDataDeletionRequest([]);
244
+ expect(getCookieStub.calledOnce).to.be.true;
245
+ expect(setCookieStub.called).to.be.false;
246
+ expect(getDataFromLocalStorageStub.calledOnce).to.be.true
247
+ expect(removeDataFromLocalStorageStub.called).to.be.false;
248
+ expect(ajaxStub.called).to.be.false;
249
+ });
229
250
  });
230
251
 
231
252
  describe('isBidRequestValid', function () {
@@ -19,6 +19,9 @@ describe('FreePass adapter', function () {
19
19
  }
20
20
  },
21
21
  adUnitCode: 'adunit-code',
22
+ params: {
23
+ publisherId: 'publisherIdValue'
24
+ }
22
25
  };
23
26
 
24
27
  it('should return true when required params found', function () {
@@ -30,6 +33,12 @@ describe('FreePass adapter', function () {
30
33
  delete localBid.adUnitCode;
31
34
  expect(spec.isBidRequestValid(localBid)).to.equal(false);
32
35
  });
36
+
37
+ it('should return false when params.publisherId is missing', function () {
38
+ let localBid = Object.assign({}, bid);
39
+ delete localBid.params.publisherId;
40
+ expect(spec.isBidRequestValid(localBid)).to.equal(false);
41
+ });
33
42
  });
34
43
 
35
44
  describe('buildRequests', function () {
@@ -43,6 +52,10 @@ describe('FreePass adapter', function () {
43
52
  'userId': '56c4c789-71ce-46f5-989e-9e543f3d5f96',
44
53
  'commonId': 'commonIdValue'
45
54
  }
55
+ },
56
+ 'adUnitCode': 'adunit-code',
57
+ 'params': {
58
+ 'publisherId': 'publisherIdValue'
46
59
  }
47
60
  }];
48
61
  bidderRequest = {};
@@ -108,6 +121,33 @@ describe('FreePass adapter', function () {
108
121
  expect(ortbData.device.ext).to.be.an('object');
109
122
  expect(ortbData.device.ext.is_accurate_ip).to.equal(0);
110
123
  });
124
+
125
+ it('it should add publisher related information w/o publisherUrl', function () {
126
+ const bidRequest = spec.buildRequests(bidRequests, bidderRequest);
127
+ const ortbData = bidRequest.data;
128
+ expect(ortbData.site).to.be.an('object');
129
+ expect(ortbData.site.publisher.id).to.equal('publisherIdValue');
130
+ // publisher.domain is optional
131
+ expect(ortbData.site.publisher.domain).to.be.undefined;
132
+ });
133
+
134
+ it('it should add publisher related information w/ publisherUrl', function () {
135
+ const PUBLISHER_URL = 'publisherUrlValue';
136
+ let localBidRequests = [Object.assign({}, bidRequests[0])];
137
+ localBidRequests[0].params.publisherUrl = PUBLISHER_URL;
138
+ const bidRequest = spec.buildRequests(localBidRequests, bidderRequest);
139
+ const ortbData = bidRequest.data;
140
+ expect(ortbData.site).to.be.an('object');
141
+ expect(ortbData.site.publisher.id).to.equal('publisherIdValue');
142
+ // publisher.domain is optional. set when given
143
+ expect(ortbData.site.publisher.domain).to.equal(PUBLISHER_URL);
144
+ });
145
+
146
+ it('it should imp.tagId from adUnitCode', function () {
147
+ const bidRequest = spec.buildRequests(bidRequests, bidderRequest);
148
+ const ortbData = bidRequest.data;
149
+ expect(ortbData.imp[0].tagId).to.equal('adunit-code');
150
+ });
111
151
  });
112
152
 
113
153
  describe('interpretResponse', function () {
@@ -122,6 +162,10 @@ describe('FreePass adapter', function () {
122
162
  'userId': '56c4c789-71ce-46f5-989e-9e543f3d5f96',
123
163
  'commonId': 'commonIdValue'
124
164
  }
165
+ },
166
+ 'adUnitCode': 'adunit-code',
167
+ 'params': {
168
+ 'publisherId': 'publisherIdValue'
125
169
  }
126
170
  }];
127
171
  bidderRequest = {};
@@ -786,6 +786,74 @@ describe('TheMediaGrid Adapter', function () {
786
786
  });
787
787
  });
788
788
 
789
+ it('should prioritize pbadslot over adslot', function() {
790
+ const ortb2Imp = [{
791
+ ext: {
792
+ data: {
793
+ adserver: {
794
+ adslot: 'adslot'
795
+ }
796
+ }
797
+ }
798
+ }, {
799
+ ext: {
800
+ data: {
801
+ adserver: {
802
+ adslot: 'adslot'
803
+ },
804
+ pbadslot: 'pbadslot'
805
+ }
806
+ }
807
+ }];
808
+ const bidRequestsWithOrtb2Imp = bidRequests.slice(0, 2).map((bid, ind) => {
809
+ return Object.assign({}, bid, ortb2Imp[ind] ? { ortb2Imp: {...bid.ortb2Imp, ...ortb2Imp[ind]} } : {});
810
+ });
811
+ const [request] = spec.buildRequests(bidRequestsWithOrtb2Imp, bidderRequest);
812
+ expect(request.data).to.be.an('string');
813
+ const payload = parseRequest(request.data);
814
+ expect(payload.imp[0].ext.gpid).to.equal(ortb2Imp[0].ext.data.adserver.adslot);
815
+ expect(payload.imp[1].ext.gpid).to.equal(ortb2Imp[1].ext.data.pbadslot);
816
+ });
817
+
818
+ it('should prioritize gpid over pbadslot and adslot', function() {
819
+ const ortb2Imp = [{
820
+ ext: {
821
+ gpid: 'gpid',
822
+ data: {
823
+ adserver: {
824
+ adslot: 'adslot'
825
+ },
826
+ pbadslot: 'pbadslot'
827
+ }
828
+ }
829
+ }, {
830
+ ext: {
831
+ gpid: 'gpid',
832
+ data: {
833
+ adserver: {
834
+ adslot: 'adslot'
835
+ }
836
+ }
837
+ }
838
+ }, {
839
+ ext: {
840
+ gpid: 'gpid',
841
+ data: {
842
+ pbadslot: 'pbadslot'
843
+ }
844
+ }
845
+ }];
846
+ const bidRequestsWithOrtb2Imp = bidRequests.slice(0, 3).map((bid, ind) => {
847
+ return Object.assign({}, bid, ortb2Imp[ind] ? { ortb2Imp: {...bid.ortb2Imp, ...ortb2Imp[ind]} } : {});
848
+ });
849
+ const [request] = spec.buildRequests(bidRequestsWithOrtb2Imp, bidderRequest);
850
+ expect(request.data).to.be.an('string');
851
+ const payload = parseRequest(request.data);
852
+ expect(payload.imp[0].ext.gpid).to.equal(ortb2Imp[0].ext.gpid);
853
+ expect(payload.imp[1].ext.gpid).to.equal(ortb2Imp[1].ext.gpid);
854
+ expect(payload.imp[2].ext.gpid).to.equal(ortb2Imp[2].ext.gpid);
855
+ });
856
+
789
857
  it('should contain imp[].instl if available', function() {
790
858
  const ortb2Imp = [{
791
859
  instl: 1
@@ -915,24 +915,24 @@ let VALID_BID_REQUEST = [{
915
915
  cid: '8CUV090'
916
916
  }
917
917
  },
918
- VALID_PARAMS_AAX = {
919
- bidder: 'aax',
918
+ VALID_PARAMS_TS = {
919
+ bidder: 'trustedstack',
920
920
  params: {
921
- cid: 'AAXG123'
921
+ cid: 'TS012345'
922
922
  }
923
923
  },
924
924
  PARAMS_MISSING = {
925
925
  bidder: 'medianet',
926
926
  },
927
- PARAMS_MISSING_AAX = {
928
- bidder: 'aax',
927
+ PARAMS_MISSING_TS = {
928
+ bidder: 'trustedstack',
929
929
  },
930
930
  PARAMS_WITHOUT_CID = {
931
931
  bidder: 'medianet',
932
932
  params: {}
933
933
  },
934
- PARAMS_WITHOUT_CID_AAX = {
935
- bidder: 'aax',
934
+ PARAMS_WITHOUT_CID_TS = {
935
+ bidder: 'trustedstack',
936
936
  params: {}
937
937
  },
938
938
  PARAMS_WITH_INTEGER_CID = {
@@ -941,8 +941,8 @@ let VALID_BID_REQUEST = [{
941
941
  cid: 8867587
942
942
  }
943
943
  },
944
- PARAMS_WITH_INTEGER_CID_AAX = {
945
- bidder: 'aax',
944
+ PARAMS_WITH_INTEGER_CID_TS = {
945
+ bidder: 'trustedstack',
946
946
  params: {
947
947
  cid: 8867587
948
948
  }
@@ -953,8 +953,8 @@ let VALID_BID_REQUEST = [{
953
953
  cid: ''
954
954
  }
955
955
  },
956
- PARAMS_WITH_EMPTY_CID_AAX = {
957
- bidder: 'aax',
956
+ PARAMS_WITH_EMPTY_CID_TS = {
957
+ bidder: 'trustedstack',
958
958
  params: {
959
959
  cid: ''
960
960
  }
@@ -1783,34 +1783,34 @@ describe('Media.net bid adapter', function () {
1783
1783
  });
1784
1784
  });
1785
1785
 
1786
- describe('isBidRequestValid aax', function () {
1786
+ describe('isBidRequestValid trustedstack', function () {
1787
1787
  it('should accept valid bid params', function () {
1788
- let isValid = spec.isBidRequestValid(VALID_PARAMS_AAX);
1788
+ let isValid = spec.isBidRequestValid(VALID_PARAMS_TS);
1789
1789
  expect(isValid).to.equal(true);
1790
1790
  });
1791
1791
 
1792
1792
  it('should reject bid if cid is not present', function () {
1793
- let isValid = spec.isBidRequestValid(PARAMS_WITHOUT_CID_AAX);
1793
+ let isValid = spec.isBidRequestValid(PARAMS_WITHOUT_CID_TS);
1794
1794
  expect(isValid).to.equal(false);
1795
1795
  });
1796
1796
 
1797
1797
  it('should reject bid if cid is not a string', function () {
1798
- let isValid = spec.isBidRequestValid(PARAMS_WITH_INTEGER_CID_AAX);
1798
+ let isValid = spec.isBidRequestValid(PARAMS_WITH_INTEGER_CID_TS);
1799
1799
  expect(isValid).to.equal(false);
1800
1800
  });
1801
1801
 
1802
1802
  it('should reject bid if cid is a empty string', function () {
1803
- let isValid = spec.isBidRequestValid(PARAMS_WITH_EMPTY_CID_AAX);
1803
+ let isValid = spec.isBidRequestValid(PARAMS_WITH_EMPTY_CID_TS);
1804
1804
  expect(isValid).to.equal(false);
1805
1805
  });
1806
1806
 
1807
1807
  it('should have missing params', function () {
1808
- let isValid = spec.isBidRequestValid(PARAMS_MISSING_AAX);
1808
+ let isValid = spec.isBidRequestValid(PARAMS_MISSING_TS);
1809
1809
  expect(isValid).to.equal(false);
1810
1810
  });
1811
1811
  });
1812
1812
 
1813
- describe('interpretResponse aax', function () {
1813
+ describe('interpretResponse trustedstack', function () {
1814
1814
  it('should not push response if no-bid', function () {
1815
1815
  let validBids = [];
1816
1816
  let bids = spec.interpretResponse(SERVER_RESPONSE_NOBID, []);
@@ -1,5 +1,6 @@
1
1
  import {expect} from 'chai';
2
2
  import {spec} from 'modules/mediasquareBidAdapter.js';
3
+ import { server } from 'test/mocks/xhr.js';
3
4
 
4
5
  describe('MediaSquare bid adapter tests', function () {
5
6
  var DEFAULT_PARAMS = [{
@@ -208,6 +209,10 @@ describe('MediaSquare bid adapter tests', function () {
208
209
  const response = spec.interpretResponse(BID_RESPONSE, request);
209
210
  const won = spec.onBidWon(response[0]);
210
211
  expect(won).to.equal(true);
212
+ expect(server.requests.length).to.equal(1);
213
+ let message = JSON.parse(server.requests[0].requestBody);
214
+ expect(message).to.have.property('increment').exist;
215
+ expect(message).to.have.property('increment').and.to.equal('1');
211
216
  });
212
217
  it('Verifies user sync without cookie in bid response', function () {
213
218
  var syncs = spec.getUserSyncs({}, [BID_RESPONSE], DEFAULT_OPTIONS.gdprConsent, DEFAULT_OPTIONS.uspConsent);