prebid.js 8.0.0 → 8.2.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 (232) hide show
  1. package/.devcontainer/devcontainer.json +3 -1
  2. package/dist/33acrossBidAdapter.js +1 -1
  3. package/dist/33acrossIdSystem.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/admanBidAdapter.js +1 -1
  8. package/dist/adqueryBidAdapter.js +1 -1
  9. package/dist/adrelevantisBidAdapter.js +1 -1
  10. package/dist/adtrgtmeBidAdapter.js +1 -1
  11. package/dist/adxcgBidAdapter.js +1 -1
  12. package/dist/adyoulikeBidAdapter.js +1 -1
  13. package/dist/ajaBidAdapter.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/axonixBidAdapter.js +1 -1
  20. package/dist/bedigitechBidAdapter.js +1 -1
  21. package/dist/beopBidAdapter.js +1 -1
  22. package/dist/bidglassBidAdapter.js +1 -1
  23. package/dist/bidwatchAnalyticsAdapter.js +1 -1
  24. package/dist/big-richmediaBidAdapter.js +1 -1
  25. package/dist/bridBidAdapter.js +1 -0
  26. package/dist/bridgewellBidAdapter.js +1 -1
  27. package/dist/brightMountainMediaBidAdapter.js +1 -1
  28. package/dist/carodaBidAdapter.js +1 -1
  29. package/dist/categoryTranslation.js +1 -1
  30. package/dist/chtnwBidAdapter.js +1 -1
  31. package/dist/cmp.js +1 -0
  32. package/dist/colossussspBidAdapter.js +1 -1
  33. package/dist/conceptxBidAdapter.js +1 -1
  34. package/dist/concertBidAdapter.js +1 -1
  35. package/dist/connectadBidAdapter.js +1 -1
  36. package/dist/consentManagement.js +1 -1
  37. package/dist/consentManagementGpp.js +1 -1
  38. package/dist/consentManagementUsp.js +1 -1
  39. package/dist/consumableBidAdapter.js +1 -1
  40. package/dist/conversantAnalyticsAdapter.js +1 -1
  41. package/dist/conversantBidAdapter.js +1 -1
  42. package/dist/craftBidAdapter.js +1 -1
  43. package/dist/criteoBidAdapter.js +1 -1
  44. package/dist/cwireBidAdapter.js +1 -1
  45. package/dist/dependencies.json +15 -0
  46. package/dist/dspxBidAdapter.js +1 -1
  47. package/dist/eplanningBidAdapter.js +1 -1
  48. package/dist/euidIdSystem.js +1 -1
  49. package/dist/feedadBidAdapter.js +1 -1
  50. package/dist/finativeBidAdapter.js +1 -1
  51. package/dist/freepassBidAdapter.js +1 -0
  52. package/dist/freewheel-sspBidAdapter.js +1 -1
  53. package/dist/gmosspBidAdapter.js +1 -1
  54. package/dist/goldbachBidAdapter.js +1 -1
  55. package/dist/gppControl_usnat.js +1 -0
  56. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  57. package/dist/greenbidsRtdProvider.js +1 -1
  58. package/dist/gridBidAdapter.js +1 -1
  59. package/dist/gumgumBidAdapter.js +1 -1
  60. package/dist/h12mediaBidAdapter.js +1 -1
  61. package/dist/hypelabBidAdapter.js +1 -1
  62. package/dist/id5IdSystem.js +1 -1
  63. package/dist/imdsBidAdapter.js +1 -1
  64. package/dist/improvedigitalBidAdapter.js +1 -1
  65. package/dist/insticatorBidAdapter.js +1 -1
  66. package/dist/intentIqIdSystem.js +1 -1
  67. package/dist/ixBidAdapter.js +1 -1
  68. package/dist/justpremiumBidAdapter.js +1 -1
  69. package/dist/kargoBidAdapter.js +1 -1
  70. package/dist/kiviadsBidAdapter.js +1 -0
  71. package/dist/konduitAnalyticsAdapter.js +1 -1
  72. package/dist/kueezBidAdapter.js +1 -1
  73. package/dist/kueezRtbBidAdapter.js +1 -1
  74. package/dist/kulturemediaBidAdapter.js +1 -1
  75. package/dist/lassoBidAdapter.js +1 -1
  76. package/dist/lifestreetBidAdapter.js +1 -1
  77. package/dist/liveIntentIdSystem.js +1 -1
  78. package/dist/logicadBidAdapter.js +1 -1
  79. package/dist/loglyliftBidAdapter.js +1 -1
  80. package/dist/magniteAnalyticsAdapter.js +1 -1
  81. package/dist/malltvAnalyticsAdapter.js +1 -1
  82. package/dist/marsmediaBidAdapter.js +1 -1
  83. package/dist/mediafuseBidAdapter.js +1 -1
  84. package/dist/mediasquareBidAdapter.js +1 -1
  85. package/dist/mgidBidAdapter.js +1 -1
  86. package/dist/mgidXBidAdapter.js +1 -0
  87. package/dist/minutemediaBidAdapter.js +1 -1
  88. package/dist/minutemediaplusBidAdapter.js +1 -1
  89. package/dist/mspa.js +1 -0
  90. package/dist/nexx360BidAdapter.js +1 -1
  91. package/dist/not-for-prod/prebid.js +146 -139
  92. package/dist/oguryBidAdapter.js +1 -1
  93. package/dist/onetagBidAdapter.js +1 -1
  94. package/dist/ooloAnalyticsAdapter.js +1 -1
  95. package/dist/optidigitalBidAdapter.js +1 -1
  96. package/dist/outbrainBidAdapter.js +1 -1
  97. package/dist/oxxionAnalyticsAdapter.js +1 -1
  98. package/dist/oxxionRtdProvider.js +1 -1
  99. package/dist/parrableIdSystem.js +1 -1
  100. package/dist/pixfutureBidAdapter.js +1 -1
  101. package/dist/prebid-core.js +1 -1
  102. package/dist/publinkIdSystem.js +1 -1
  103. package/dist/pubmaticBidAdapter.js +1 -1
  104. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  105. package/dist/pxyzBidAdapter.js +1 -1
  106. package/dist/quantcastBidAdapter.js +1 -1
  107. package/dist/readpeakBidAdapter.js +1 -1
  108. package/dist/relaidoBidAdapter.js +1 -1
  109. package/dist/retailspotBidAdapter.js +1 -1
  110. package/dist/rhythmoneBidAdapter.js +1 -1
  111. package/dist/riseBidAdapter.js +1 -1
  112. package/dist/rtbhouseBidAdapter.js +1 -1
  113. package/dist/rubiconBidAdapter.js +1 -1
  114. package/dist/seedingAllianceBidAdapter.js +1 -1
  115. package/dist/seedtagBidAdapter.js +1 -1
  116. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  117. package/dist/sharethroughBidAdapter.js +1 -1
  118. package/dist/shinezBidAdapter.js +1 -1
  119. package/dist/smaatoBidAdapter.js +1 -1
  120. package/dist/smartadserverBidAdapter.js +1 -1
  121. package/dist/smartxBidAdapter.js +1 -1
  122. package/dist/smilewantedBidAdapter.js +1 -1
  123. package/dist/sonobiBidAdapter.js +1 -1
  124. package/dist/sovrnAnalyticsAdapter.js +1 -1
  125. package/dist/sovrnBidAdapter.js +1 -1
  126. package/dist/sspBCBidAdapter.js +1 -1
  127. package/dist/stvBidAdapter.js +1 -1
  128. package/dist/sublimeBidAdapter.js +1 -1
  129. package/dist/targetVideoBidAdapter.js +1 -1
  130. package/dist/teadsBidAdapter.js +1 -1
  131. package/dist/trionBidAdapter.js +1 -1
  132. package/dist/tripleliftBidAdapter.js +1 -1
  133. package/dist/ttdBidAdapter.js +1 -1
  134. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  135. package/dist/uid2IdSystem.js +1 -1
  136. package/dist/underdogmediaBidAdapter.js +1 -1
  137. package/dist/undertoneBidAdapter.js +1 -1
  138. package/dist/userId.js +1 -1
  139. package/dist/vidazooBidAdapter.js +1 -1
  140. package/dist/videobyteBidAdapter.js +1 -1
  141. package/dist/visxBidAdapter.js +1 -1
  142. package/dist/vuukleBidAdapter.js +1 -1
  143. package/dist/widespaceBidAdapter.js +1 -1
  144. package/dist/winrBidAdapter.js +1 -1
  145. package/dist/yahoosspBidAdapter.js +1 -1
  146. package/dist/yieldmoBidAdapter.js +1 -1
  147. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  148. package/libraries/cmp/cmpClient.js +139 -0
  149. package/libraries/mspa/activityControls.js +91 -0
  150. package/modules/admanBidAdapter.js +5 -0
  151. package/modules/amxBidAdapter.js +11 -12
  152. package/modules/bedigitechBidAdapter.js +15 -12
  153. package/modules/bedigitechBidAdapter.md +2 -2
  154. package/modules/beopBidAdapter.js +0 -4
  155. package/modules/bidwatchAnalyticsAdapter.js +33 -5
  156. package/modules/bridBidAdapter.js +223 -0
  157. package/modules/categoryTranslation.js +3 -2
  158. package/modules/colossussspBidAdapter.js +9 -0
  159. package/modules/conceptxBidAdapter.js +6 -3
  160. package/modules/consentManagement.js +12 -86
  161. package/modules/consentManagementGpp.js +47 -126
  162. package/modules/consentManagementUsp.js +19 -97
  163. package/modules/freepassBidAdapter.js +98 -0
  164. package/modules/freepassBidAdapter.md +31 -0
  165. package/modules/freepassIdSystem.md +1 -1
  166. package/modules/gppControl_usnat.js +11 -0
  167. package/modules/greenbidsAnalyticsAdapter.js +7 -13
  168. package/modules/gridBidAdapter.js +3 -4
  169. package/modules/intentIqIdSystem.js +11 -9
  170. package/modules/ixBidAdapter.js +284 -55
  171. package/modules/kiviadsBidAdapter.js +212 -0
  172. package/modules/kiviadsBidAdapter.md +79 -0
  173. package/modules/liveIntentIdSystem.js +8 -3
  174. package/modules/mediasquareBidAdapter.js +19 -23
  175. package/modules/mgidXBidAdapter.js +263 -0
  176. package/modules/mgidXBidAdapter.md +79 -0
  177. package/modules/oxxionAnalyticsAdapter.js +33 -5
  178. package/modules/oxxionRtdProvider.js +124 -11
  179. package/modules/oxxionRtdProvider.md +19 -4
  180. package/modules/pubmaticBidAdapter.js +18 -2
  181. package/modules/rtbhouseBidAdapter.js +9 -2
  182. package/modules/rtbhouseBidAdapter.md +27 -8
  183. package/modules/rubiconBidAdapter.js +13 -1
  184. package/modules/sharethroughBidAdapter.js +14 -0
  185. package/modules/sonobiBidAdapter.js +4 -7
  186. package/modules/tripleliftBidAdapter.js +21 -1
  187. package/modules/userId/eids.js +29 -0
  188. package/modules/userId/eids.md +19 -2
  189. package/modules/userId/index.js +78 -29
  190. package/modules/userId/userId.md +3 -0
  191. package/package.json +1 -1
  192. package/src/activities/params.js +4 -1
  193. package/test/spec/libraries/cmp/cmpClient_spec.js +233 -0
  194. package/test/spec/libraries/mspa/activityControls_spec.js +315 -0
  195. package/test/spec/modules/admanBidAdapter_spec.js +8 -2
  196. package/test/spec/modules/adqueryBidAdapter_spec.js +5 -1
  197. package/test/spec/modules/amxBidAdapter_spec.js +6 -3
  198. package/test/spec/modules/bedigitechBidAdapter_spec.js +25 -36
  199. package/test/spec/modules/bidwatchAnalyticsAdapter_spec.js +21 -1
  200. package/test/spec/modules/bridBidAdapter_spec.js +129 -0
  201. package/test/spec/modules/byDataAnalyticsAdapter_spec.js +9 -7
  202. package/test/spec/modules/chtnwBidAdapter_spec.js +4 -1
  203. package/test/spec/modules/colossussspBidAdapter_spec.js +29 -0
  204. package/test/spec/modules/consentManagementGpp_spec.js +84 -7
  205. package/test/spec/modules/consentManagement_spec.js +8 -18
  206. package/test/spec/modules/datablocksBidAdapter_spec.js +7 -3
  207. package/test/spec/modules/eids_spec.js +87 -0
  208. package/test/spec/modules/freepassBidAdapter_spec.js +161 -0
  209. package/test/spec/modules/greenbidsAnalyticsAdapter_spec.js +0 -15
  210. package/test/spec/modules/gridBidAdapter_spec.js +29 -28
  211. package/test/spec/modules/insticatorBidAdapter_spec.js +6 -2
  212. package/test/spec/modules/intentIqIdSystem_spec.js +36 -2
  213. package/test/spec/modules/ixBidAdapter_spec.js +785 -15
  214. package/test/spec/modules/kiviadsBidAdapter_spec.js +404 -0
  215. package/test/spec/modules/lassoBidAdapter_spec.js +6 -4
  216. package/test/spec/modules/liveIntentIdMinimalSystem_spec.js +17 -2
  217. package/test/spec/modules/liveIntentIdSystem_spec.js +11 -6
  218. package/test/spec/modules/mediasquareBidAdapter_spec.js +3 -0
  219. package/test/spec/modules/mgidXBidAdapter_spec.js +426 -0
  220. package/test/spec/modules/onetagBidAdapter_spec.js +81 -75
  221. package/test/spec/modules/orbidderBidAdapter_spec.js +6 -3
  222. package/test/spec/modules/oxxionAnalyticsAdapter_spec.js +21 -2
  223. package/test/spec/modules/oxxionRtdProvider_spec.js +113 -1
  224. package/test/spec/modules/pubmaticBidAdapter_spec.js +25 -0
  225. package/test/spec/modules/relaidoBidAdapter_spec.js +4 -3
  226. package/test/spec/modules/rtbhouseBidAdapter_spec.js +35 -0
  227. package/test/spec/modules/rubiconBidAdapter_spec.js +41 -0
  228. package/test/spec/modules/sharethroughBidAdapter_spec.js +75 -0
  229. package/test/spec/modules/sonobiBidAdapter_spec.js +15 -15
  230. package/test/spec/modules/tripleliftBidAdapter_spec.js +20 -1
  231. package/test/spec/modules/ucfunnelBidAdapter_spec.js +37 -16
  232. package/test/spec/modules/userId_spec.js +393 -6
@@ -0,0 +1,404 @@
1
+ import { expect } from 'chai';
2
+ import { spec } from '../../../modules/kiviadsBidAdapter.js';
3
+ import { BANNER, VIDEO, NATIVE } from '../../../src/mediaTypes.js';
4
+ import { getUniqueIdentifierStr } from '../../../src/utils.js';
5
+
6
+ const bidder = 'kiviads'
7
+ const adUrl = 'https://lb.kiviads.com/pbjs';
8
+ const syncUrl = 'https://sync.kiviads.com';
9
+
10
+ describe('KiviAdsBidAdapter', function () {
11
+ const bids = [
12
+ {
13
+ bidId: getUniqueIdentifierStr(),
14
+ bidder: bidder,
15
+ mediaTypes: {
16
+ [BANNER]: {
17
+ sizes: [[300, 250]]
18
+ }
19
+ },
20
+ params: {
21
+ placementId: 'testBanner',
22
+ }
23
+ },
24
+ {
25
+ bidId: getUniqueIdentifierStr(),
26
+ bidder: bidder,
27
+ mediaTypes: {
28
+ [VIDEO]: {
29
+ playerSize: [[300, 300]],
30
+ minduration: 5,
31
+ maxduration: 60
32
+ }
33
+ },
34
+ params: {
35
+ placementId: 'testVideo',
36
+ }
37
+ },
38
+ {
39
+ bidId: getUniqueIdentifierStr(),
40
+ bidder: bidder,
41
+ mediaTypes: {
42
+ [NATIVE]: {
43
+ native: {
44
+ title: {
45
+ required: true
46
+ },
47
+ body: {
48
+ required: true
49
+ },
50
+ icon: {
51
+ required: true,
52
+ size: [64, 64]
53
+ }
54
+ }
55
+ }
56
+ },
57
+ params: {
58
+ placementId: 'testNative',
59
+ }
60
+ }
61
+ ];
62
+
63
+ const invalidBid = {
64
+ bidId: getUniqueIdentifierStr(),
65
+ bidder: bidder,
66
+ mediaTypes: {
67
+ [BANNER]: {
68
+ sizes: [[300, 250]]
69
+ }
70
+ },
71
+ params: {
72
+
73
+ }
74
+ }
75
+
76
+ const bidderRequest = {
77
+ uspConsent: '1---',
78
+ gdprConsent: 'COvFyGBOvFyGBAbAAAENAPCAAOAAAAAAAAAAAEEUACCKAAA.IFoEUQQgAIQwgIwQABAEAAAAOIAACAIAAAAQAIAgEAACEAAAAAgAQBAAAAAAAGBAAgAAAAAAAFAAECAAAgAAQARAEQAAAAAJAAIAAgAAAYQEAAAQmAgBC3ZAYzUw',
79
+ refererInfo: {
80
+ referer: 'https://test.com'
81
+ },
82
+ bidderTimeout: 300
83
+ };
84
+
85
+ describe('isBidRequestValid', function () {
86
+ it('Should return true if there are bidId, params and key parameters present', function () {
87
+ expect(spec.isBidRequestValid(bids[0])).to.be.true;
88
+ });
89
+ it('Should return false if at least one of parameters is not present', function () {
90
+ expect(spec.isBidRequestValid(invalidBid)).to.be.false;
91
+ });
92
+ });
93
+
94
+ describe('buildRequests', function () {
95
+ let serverRequest = spec.buildRequests(bids, bidderRequest);
96
+
97
+ it('Creates a ServerRequest object with method, URL and data', function () {
98
+ expect(serverRequest).to.exist;
99
+ expect(serverRequest.method).to.exist;
100
+ expect(serverRequest.url).to.exist;
101
+ expect(serverRequest.data).to.exist;
102
+ });
103
+
104
+ it('Returns POST method', function () {
105
+ expect(serverRequest.method).to.equal('POST');
106
+ });
107
+
108
+ it('Returns valid URL', function () {
109
+ expect(serverRequest.url).to.equal(adUrl);
110
+ });
111
+
112
+ it('Returns general data valid', function () {
113
+ let data = serverRequest.data;
114
+ expect(data).to.be.an('object');
115
+ expect(data).to.have.all.keys('deviceWidth',
116
+ 'deviceHeight',
117
+ 'language',
118
+ 'secure',
119
+ 'host',
120
+ 'page',
121
+ 'placements',
122
+ 'coppa',
123
+ 'ccpa',
124
+ 'gdpr',
125
+ 'gpp',
126
+ 'tmax'
127
+ );
128
+ expect(data.deviceWidth).to.be.a('number');
129
+ expect(data.deviceHeight).to.be.a('number');
130
+ expect(data.language).to.be.a('string');
131
+ expect(data.secure).to.be.within(0, 1);
132
+ expect(data.host).to.be.a('string');
133
+ expect(data.host).to.contain('localhost');
134
+ expect(data.page).to.be.a('string');
135
+ expect(data.page).to.equal('/');
136
+ expect(data.coppa).to.be.a('number');
137
+ expect(data.gdpr).to.be.a('string');
138
+ expect(data.ccpa).to.be.a('string');
139
+ expect(data.tmax).to.be.a('number');
140
+ expect(data.placements).to.have.lengthOf(3);
141
+ });
142
+
143
+ it('Returns valid placements', function () {
144
+ const { placements } = serverRequest.data;
145
+ for (let i = 0, len = placements.length; i < len; i++) {
146
+ const placement = placements[i];
147
+ expect(placement.placementId).to.be.oneOf(['testBanner', 'testVideo', 'testNative']);
148
+ expect(placement.adFormat).to.be.oneOf([BANNER, VIDEO, NATIVE]);
149
+ expect(placement.bidId).to.be.a('string');
150
+ expect(placement.schain).to.be.an('object');
151
+ expect(placement.bidfloor).to.exist.and.to.equal(0);
152
+ expect(placement.type).to.exist.and.to.equal('publisher');
153
+
154
+ if (placement.adFormat === BANNER) {
155
+ expect(placement.sizes).to.be.an('array');
156
+ }
157
+ switch (placement.adFormat) {
158
+ case BANNER:
159
+ expect(placement.sizes).to.be.an('array');
160
+ break;
161
+ case VIDEO:
162
+ expect(placement.playerSize).to.be.an('array');
163
+ expect(placement.minduration).to.be.an('number');
164
+ expect(placement.maxduration).to.be.an('number');
165
+ break;
166
+ case NATIVE:
167
+ expect(placement.native).to.be.an('object');
168
+ break;
169
+ }
170
+ }
171
+ });
172
+
173
+ it('Returns data with gdprConsent and without uspConsent', function () {
174
+ delete bidderRequest.uspConsent;
175
+ serverRequest = spec.buildRequests(bids, bidderRequest);
176
+ let data = serverRequest.data;
177
+ expect(data.gdpr).to.exist;
178
+ expect(data.gdpr).to.be.a('string');
179
+ expect(data.gdpr).to.equal(bidderRequest.gdprConsent);
180
+ expect(data.ccpa).to.not.exist;
181
+ delete bidderRequest.gdprConsent;
182
+ });
183
+
184
+ it('Returns data with uspConsent and without gdprConsent', function () {
185
+ bidderRequest.uspConsent = '1---';
186
+ delete bidderRequest.gdprConsent;
187
+ serverRequest = spec.buildRequests(bids, bidderRequest);
188
+ let data = serverRequest.data;
189
+ expect(data.ccpa).to.exist;
190
+ expect(data.ccpa).to.be.a('string');
191
+ expect(data.ccpa).to.equal(bidderRequest.uspConsent);
192
+ expect(data.gdpr).to.not.exist;
193
+ });
194
+
195
+ it('Returns empty data if no valid requests are passed', function () {
196
+ serverRequest = spec.buildRequests([], bidderRequest);
197
+ let data = serverRequest.data;
198
+ expect(data.placements).to.be.an('array').that.is.empty;
199
+ });
200
+ });
201
+
202
+ describe('interpretResponse', function () {
203
+ it('Should interpret banner response', function () {
204
+ const banner = {
205
+ body: [{
206
+ mediaType: 'banner',
207
+ width: 300,
208
+ height: 250,
209
+ cpm: 0.4,
210
+ ad: 'Test',
211
+ requestId: '23fhj33i987f',
212
+ ttl: 120,
213
+ creativeId: '2',
214
+ netRevenue: true,
215
+ currency: 'USD',
216
+ dealId: '1',
217
+ meta: {
218
+ advertiserDomains: ['google.com'],
219
+ advertiserId: 1234
220
+ }
221
+ }]
222
+ };
223
+ let bannerResponses = spec.interpretResponse(banner);
224
+ expect(bannerResponses).to.be.an('array').that.is.not.empty;
225
+ let dataItem = bannerResponses[0];
226
+ expect(dataItem).to.have.all.keys('requestId', 'cpm', 'width', 'height', 'ad', 'ttl', 'creativeId',
227
+ 'netRevenue', 'currency', 'dealId', 'mediaType', 'meta');
228
+ expect(dataItem.requestId).to.equal(banner.body[0].requestId);
229
+ expect(dataItem.cpm).to.equal(banner.body[0].cpm);
230
+ expect(dataItem.width).to.equal(banner.body[0].width);
231
+ expect(dataItem.height).to.equal(banner.body[0].height);
232
+ expect(dataItem.ad).to.equal(banner.body[0].ad);
233
+ expect(dataItem.ttl).to.equal(banner.body[0].ttl);
234
+ expect(dataItem.creativeId).to.equal(banner.body[0].creativeId);
235
+ expect(dataItem.netRevenue).to.be.true;
236
+ expect(dataItem.currency).to.equal(banner.body[0].currency);
237
+ expect(dataItem.meta).to.be.an('object').that.has.any.key('advertiserDomains');
238
+ });
239
+ it('Should interpret video response', function () {
240
+ const video = {
241
+ body: [{
242
+ vastUrl: 'test.com',
243
+ mediaType: 'video',
244
+ cpm: 0.5,
245
+ requestId: '23fhj33i987f',
246
+ ttl: 120,
247
+ creativeId: '2',
248
+ netRevenue: true,
249
+ currency: 'USD',
250
+ dealId: '1',
251
+ meta: {
252
+ advertiserDomains: ['google.com'],
253
+ advertiserId: 1234
254
+ }
255
+ }]
256
+ };
257
+ let videoResponses = spec.interpretResponse(video);
258
+ expect(videoResponses).to.be.an('array').that.is.not.empty;
259
+
260
+ let dataItem = videoResponses[0];
261
+ expect(dataItem).to.have.all.keys('requestId', 'cpm', 'vastUrl', 'ttl', 'creativeId',
262
+ 'netRevenue', 'currency', 'dealId', 'mediaType', 'meta');
263
+ expect(dataItem.requestId).to.equal('23fhj33i987f');
264
+ expect(dataItem.cpm).to.equal(0.5);
265
+ expect(dataItem.vastUrl).to.equal('test.com');
266
+ expect(dataItem.ttl).to.equal(120);
267
+ expect(dataItem.creativeId).to.equal('2');
268
+ expect(dataItem.netRevenue).to.be.true;
269
+ expect(dataItem.currency).to.equal('USD');
270
+ expect(dataItem.meta).to.be.an('object').that.has.any.key('advertiserDomains');
271
+ });
272
+ it('Should interpret native response', function () {
273
+ const native = {
274
+ body: [{
275
+ mediaType: 'native',
276
+ native: {
277
+ clickUrl: 'test.com',
278
+ title: 'Test',
279
+ image: 'test.com',
280
+ impressionTrackers: ['test.com'],
281
+ },
282
+ ttl: 120,
283
+ cpm: 0.4,
284
+ requestId: '23fhj33i987f',
285
+ creativeId: '2',
286
+ netRevenue: true,
287
+ currency: 'USD',
288
+ meta: {
289
+ advertiserDomains: ['google.com'],
290
+ advertiserId: 1234
291
+ }
292
+ }]
293
+ };
294
+ let nativeResponses = spec.interpretResponse(native);
295
+ expect(nativeResponses).to.be.an('array').that.is.not.empty;
296
+
297
+ let dataItem = nativeResponses[0];
298
+ expect(dataItem).to.have.keys('requestId', 'cpm', 'ttl', 'creativeId', 'netRevenue', 'currency', 'mediaType', 'native', 'meta');
299
+ expect(dataItem.native).to.have.keys('clickUrl', 'impressionTrackers', 'title', 'image')
300
+ expect(dataItem.requestId).to.equal('23fhj33i987f');
301
+ expect(dataItem.cpm).to.equal(0.4);
302
+ expect(dataItem.native.clickUrl).to.equal('test.com');
303
+ expect(dataItem.native.title).to.equal('Test');
304
+ expect(dataItem.native.image).to.equal('test.com');
305
+ expect(dataItem.native.impressionTrackers).to.be.an('array').that.is.not.empty;
306
+ expect(dataItem.native.impressionTrackers[0]).to.equal('test.com');
307
+ expect(dataItem.ttl).to.equal(120);
308
+ expect(dataItem.creativeId).to.equal('2');
309
+ expect(dataItem.netRevenue).to.be.true;
310
+ expect(dataItem.currency).to.equal('USD');
311
+ expect(dataItem.meta).to.be.an('object').that.has.any.key('advertiserDomains');
312
+ });
313
+ it('Should return an empty array if invalid banner response is passed', function () {
314
+ const invBanner = {
315
+ body: [{
316
+ width: 300,
317
+ cpm: 0.4,
318
+ ad: 'Test',
319
+ requestId: '23fhj33i987f',
320
+ ttl: 120,
321
+ creativeId: '2',
322
+ netRevenue: true,
323
+ currency: 'USD',
324
+ dealId: '1'
325
+ }]
326
+ };
327
+
328
+ let serverResponses = spec.interpretResponse(invBanner);
329
+ expect(serverResponses).to.be.an('array').that.is.empty;
330
+ });
331
+ it('Should return an empty array if invalid video response is passed', function () {
332
+ const invVideo = {
333
+ body: [{
334
+ mediaType: 'video',
335
+ cpm: 0.5,
336
+ requestId: '23fhj33i987f',
337
+ ttl: 120,
338
+ creativeId: '2',
339
+ netRevenue: true,
340
+ currency: 'USD',
341
+ dealId: '1'
342
+ }]
343
+ };
344
+ let serverResponses = spec.interpretResponse(invVideo);
345
+ expect(serverResponses).to.be.an('array').that.is.empty;
346
+ });
347
+ it('Should return an empty array if invalid native response is passed', function () {
348
+ const invNative = {
349
+ body: [{
350
+ mediaType: 'native',
351
+ clickUrl: 'test.com',
352
+ title: 'Test',
353
+ impressionTrackers: ['test.com'],
354
+ ttl: 120,
355
+ requestId: '23fhj33i987f',
356
+ creativeId: '2',
357
+ netRevenue: true,
358
+ currency: 'USD',
359
+ }]
360
+ };
361
+ let serverResponses = spec.interpretResponse(invNative);
362
+ expect(serverResponses).to.be.an('array').that.is.empty;
363
+ });
364
+ it('Should return an empty array if invalid response is passed', function () {
365
+ const invalid = {
366
+ body: [{
367
+ ttl: 120,
368
+ creativeId: '2',
369
+ netRevenue: true,
370
+ currency: 'USD',
371
+ dealId: '1'
372
+ }]
373
+ };
374
+ let serverResponses = spec.interpretResponse(invalid);
375
+ expect(serverResponses).to.be.an('array').that.is.empty;
376
+ });
377
+ });
378
+
379
+ describe('getUserSyncs', function() {
380
+ it('Should return array of objects with proper sync config , include GDPR', function() {
381
+ const syncData = spec.getUserSyncs({}, {}, {
382
+ consentString: 'ALL',
383
+ gdprApplies: true,
384
+ }, {});
385
+ expect(syncData).to.be.an('array').which.is.not.empty;
386
+ expect(syncData[0]).to.be.an('object')
387
+ expect(syncData[0].type).to.be.a('string')
388
+ expect(syncData[0].type).to.equal('image')
389
+ expect(syncData[0].url).to.be.a('string')
390
+ expect(syncData[0].url).to.equal(`${syncUrl}/image?pbjs=1&gdpr=1&gdpr_consent=ALL&coppa=0`)
391
+ });
392
+ it('Should return array of objects with proper sync config , include CCPA', function() {
393
+ const syncData = spec.getUserSyncs({}, {}, {}, {
394
+ consentString: '1---'
395
+ });
396
+ expect(syncData).to.be.an('array').which.is.not.empty;
397
+ expect(syncData[0]).to.be.an('object')
398
+ expect(syncData[0].type).to.be.a('string')
399
+ expect(syncData[0].type).to.equal('image')
400
+ expect(syncData[0].url).to.be.a('string')
401
+ expect(syncData[0].url).to.equal(`${syncUrl}/image?pbjs=1&ccpa_consent=1---&coppa=0`)
402
+ });
403
+ });
404
+ });
@@ -79,10 +79,12 @@ describe('lassoBidAdapter', function () {
79
79
  });
80
80
 
81
81
  describe('buildRequests', function () {
82
- const validBidRequests = spec.buildRequests([bid], bidderRequest);
83
- expect(validBidRequests).to.be.an('array').that.is.not.empty;
84
-
85
- const bidRequest = validBidRequests[0];
82
+ let validBidRequests, bidRequest;
83
+ before(() => {
84
+ validBidRequests = spec.buildRequests([bid], bidderRequest);
85
+ expect(validBidRequests).to.be.an('array').that.is.not.empty;
86
+ bidRequest = validBidRequests[0];
87
+ })
86
88
 
87
89
  it('Returns valid bidRequest', function () {
88
90
  expect(bidRequest).to.exist;
@@ -243,12 +243,27 @@ describe('LiveIntentMinimalId', function() {
243
243
 
244
244
  it('should decode a uid2 to a seperate object when present', function() {
245
245
  const result = liveIntentIdSubmodule.decode({ nonId: 'foo', uid2: 'bar' });
246
- expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'uid2': 'bar'}, 'uid2': {'id': 'bar'}});
246
+ expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'uid2': 'bar'}, 'uid2': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
247
247
  });
248
248
 
249
249
  it('should decode values with uid2 but no nonId', function() {
250
250
  const result = liveIntentIdSubmodule.decode({ uid2: 'bar' });
251
- expect(result).to.eql({'uid2': {'id': 'bar'}});
251
+ expect(result).to.eql({'uid2': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
252
+ });
253
+
254
+ it('should decode a bidswitch id to a seperate object when present', function() {
255
+ const result = liveIntentIdSubmodule.decode({ nonId: 'foo', bidswitch: 'bar' });
256
+ expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'bidswitch': 'bar'}, 'bidswitch': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
257
+ });
258
+
259
+ it('should decode a medianet id to a seperate object when present', function() {
260
+ const result = liveIntentIdSubmodule.decode({ nonId: 'foo', medianet: 'bar' });
261
+ expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'medianet': 'bar'}, 'medianet': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
262
+ });
263
+
264
+ it('should decode a magnite id to a seperate object when present', function() {
265
+ const result = liveIntentIdSubmodule.decode({ nonId: 'foo', magnite: 'bar' });
266
+ expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'magnite': 'bar'}, 'magnite': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
252
267
  });
253
268
 
254
269
  it('should allow disabling nonId resolution', function() {
@@ -355,22 +355,27 @@ describe('LiveIntentId', function() {
355
355
 
356
356
  it('should decode a uid2 to a seperate object when present', function() {
357
357
  const result = liveIntentIdSubmodule.decode({ nonId: 'foo', uid2: 'bar' });
358
- expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'uid2': 'bar'}, 'uid2': {'id': 'bar'}});
358
+ expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'uid2': 'bar'}, 'uid2': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
359
+ });
360
+
361
+ it('should decode values with uid2 but no nonId', function() {
362
+ const result = liveIntentIdSubmodule.decode({ uid2: 'bar' });
363
+ expect(result).to.eql({'uid2': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
359
364
  });
360
365
 
361
366
  it('should decode a bidswitch id to a seperate object when present', function() {
362
367
  const result = liveIntentIdSubmodule.decode({ nonId: 'foo', bidswitch: 'bar' });
363
- expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'bidswitch': 'bar'}, 'bidswitch': {'id': 'bar'}});
368
+ expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'bidswitch': 'bar'}, 'bidswitch': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
364
369
  });
365
370
 
366
371
  it('should decode a medianet id to a seperate object when present', function() {
367
372
  const result = liveIntentIdSubmodule.decode({ nonId: 'foo', medianet: 'bar' });
368
- expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'medianet': 'bar'}, 'medianet': {'id': 'bar'}});
373
+ expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'medianet': 'bar'}, 'medianet': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
369
374
  });
370
375
 
371
- it('should decode values with uid2 but no nonId', function() {
372
- const result = liveIntentIdSubmodule.decode({ uid2: 'bar' });
373
- expect(result).to.eql({'uid2': {'id': 'bar'}});
376
+ it('should decode a magnite id to a seperate object when present', function() {
377
+ const result = liveIntentIdSubmodule.decode({ nonId: 'foo', magnite: 'bar' });
378
+ expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'magnite': 'bar'}, 'magnite': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
374
379
  });
375
380
 
376
381
  it('should allow disabling nonId resolution', function() {
@@ -99,6 +99,7 @@ describe('MediaSquare bid adapter tests', function () {
99
99
  'bid_id': 'aaaa1234',
100
100
  'adomain': ['test.com'],
101
101
  'context': 'instream',
102
+ 'increment': 1.0,
102
103
  }],
103
104
  }};
104
105
 
@@ -166,6 +167,8 @@ describe('MediaSquare bid adapter tests', function () {
166
167
  expect(bid.mediasquare.bidder).to.equal('msqClassic');
167
168
  expect(bid.mediasquare.context).to.exist;
168
169
  expect(bid.mediasquare.context).to.equal('instream');
170
+ expect(bid.mediasquare.increment).to.exist;
171
+ expect(bid.mediasquare.increment).to.equal(1.0);
169
172
  expect(bid.mediasquare.code).to.equal([DEFAULT_PARAMS[0].params.owner, DEFAULT_PARAMS[0].params.code].join('/'));
170
173
  expect(bid.meta).to.exist;
171
174
  expect(bid.meta.advertiserDomains).to.exist;