prebid.js 6.2.0 → 6.6.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 (169) hide show
  1. package/.circleci/config.yml +1 -1
  2. package/gulpfile.js +87 -82
  3. package/integrationExamples/gpt/weboramaRtdProvider_example.html +23 -14
  4. package/karma.conf.maker.js +1 -1
  5. package/modules/.submodules.json +2 -1
  6. package/modules/33acrossBidAdapter.js +189 -102
  7. package/modules/adagioBidAdapter.js +1 -1
  8. package/modules/addefendBidAdapter.js +1 -0
  9. package/modules/adkernelBidAdapter.js +148 -62
  10. package/modules/adlooxAdServerVideo.js +2 -2
  11. package/modules/adlooxAnalyticsAdapter.js +4 -4
  12. package/modules/admanBidAdapter.js +11 -4
  13. package/modules/admixerBidAdapter.js +1 -1
  14. package/modules/adnuntiusBidAdapter.js +3 -1
  15. package/modules/adomikAnalyticsAdapter.js +27 -9
  16. package/modules/adqueryIdSystem.js +103 -0
  17. package/modules/adqueryIdSystem.md +35 -0
  18. package/modules/adxcgBidAdapter.js +311 -359
  19. package/modules/adxcgBidAdapter.md +22 -21
  20. package/modules/adyoulikeBidAdapter.js +13 -9
  21. package/modules/aniviewBidAdapter.js +1 -1
  22. package/modules/appnexusBidAdapter.js +0 -1
  23. package/modules/beopBidAdapter.js +6 -4
  24. package/modules/bidViewability.js +3 -3
  25. package/modules/bidViewabilityIO.js +3 -3
  26. package/modules/bliinkBidAdapter.js +3 -2
  27. package/modules/colossussspBidAdapter.js +7 -0
  28. package/modules/compassBidAdapter.js +208 -0
  29. package/modules/compassBidAdapter.md +79 -0
  30. package/modules/consentManagement.js +7 -1
  31. package/modules/criteoBidAdapter.js +1 -1
  32. package/modules/criteoIdSystem.js +29 -7
  33. package/modules/currency.js +2 -2
  34. package/modules/cwireBidAdapter.js +3 -0
  35. package/modules/dailyhuntBidAdapter.js +435 -0
  36. package/modules/dailyhuntBidAdapter.md +4 -0
  37. package/modules/docereeBidAdapter.js +10 -1
  38. package/modules/docereeBidAdapter.md +2 -0
  39. package/modules/dspxBidAdapter.js +1 -1
  40. package/modules/engageyaBidAdapter.js +1 -1
  41. package/modules/feedadBidAdapter.js +2 -2
  42. package/modules/feedadBidAdapter.md +4 -2
  43. package/modules/futureads.md +48 -0
  44. package/modules/glimpseBidAdapter.js +82 -47
  45. package/modules/gptPreAuction.js +55 -7
  46. package/modules/gridBidAdapter.js +4 -3
  47. package/modules/gumgumBidAdapter.js +2 -2
  48. package/modules/idImportLibrary.js +45 -8
  49. package/modules/idImportLibrary.md +4 -0
  50. package/modules/improvedigitalBidAdapter.js +42 -4
  51. package/modules/instreamTracking.js +4 -4
  52. package/modules/invibesBidAdapter.js +49 -5
  53. package/modules/invibesBidAdapter.md +2 -1
  54. package/modules/ixBidAdapter.js +53 -18
  55. package/modules/kinessoIdSystem.js +1 -1
  56. package/modules/limelightDigitalBidAdapter.js +2 -1
  57. package/modules/livewrappedAnalyticsAdapter.js +3 -1
  58. package/modules/livewrappedBidAdapter.js +8 -2
  59. package/modules/loglyliftBidAdapter.js +79 -0
  60. package/modules/loglyliftBidAdapter.md +55 -0
  61. package/modules/lotamePanoramaIdSystem.js +80 -8
  62. package/modules/mediasquareBidAdapter.js +1 -9
  63. package/modules/nextMillenniumBidAdapter.js +39 -7
  64. package/modules/oguryBidAdapter.js +9 -2
  65. package/modules/onetagBidAdapter.js +4 -2
  66. package/modules/optimeraRtdProvider.js +8 -1
  67. package/modules/ozoneBidAdapter.js +21 -64
  68. package/modules/prebidServerBidAdapter/index.js +16 -12
  69. package/modules/proxistoreBidAdapter.js +0 -2
  70. package/modules/pubgeniusBidAdapter.js +1 -1
  71. package/modules/pubmaticAnalyticsAdapter.js +16 -0
  72. package/modules/pubxaiAnalyticsAdapter.js +17 -0
  73. package/modules/richaudienceBidAdapter.js +4 -4
  74. package/modules/riseBidAdapter.js +1 -1
  75. package/modules/rtbhouseBidAdapter.js +14 -4
  76. package/modules/rtdModule/index.js +49 -18
  77. package/modules/rubiconBidAdapter.js +31 -19
  78. package/modules/sharedIdSystem.js +27 -1
  79. package/modules/showheroes-bsBidAdapter.js +13 -2
  80. package/modules/tappxBidAdapter.js +8 -5
  81. package/modules/targetVideoBidAdapter.js +187 -0
  82. package/modules/targetVideoBidAdapter.md +34 -0
  83. package/modules/teadsBidAdapter.js +1 -2
  84. package/modules/telariaBidAdapter.js +2 -2
  85. package/modules/trustxBidAdapter.js +8 -16
  86. package/modules/userId/eids.js +7 -1
  87. package/modules/userId/userId.md +8 -0
  88. package/modules/vidoomyBidAdapter.js +16 -10
  89. package/modules/weboramaRtdProvider.js +288 -73
  90. package/modules/weboramaRtdProvider.md +27 -10
  91. package/modules/welectBidAdapter.js +106 -0
  92. package/modules/yahoosspBidAdapter.js +5 -1
  93. package/modules/yieldmoBidAdapter.js +23 -5
  94. package/modules/zetaSspBidAdapter.md +33 -1
  95. package/modules/zeta_global_sspAnalyticsAdapter.js +97 -0
  96. package/modules/zeta_global_sspAnalyticsAdapter.md +24 -0
  97. package/modules/zeta_global_sspBidAdapter.js +22 -1
  98. package/package.json +1 -1
  99. package/plugins/pbjsGlobals.js +28 -1
  100. package/src/auction.js +2 -2
  101. package/src/config.js +27 -3
  102. package/src/hook.js +5 -1
  103. package/src/prebid.js +21 -6
  104. package/src/targeting.js +22 -1
  105. package/src/utils.js +46 -8
  106. package/test/helpers/prebidGlobal.js +1 -0
  107. package/test/spec/config_spec.js +279 -0
  108. package/test/spec/modules/33acrossBidAdapter_spec.js +300 -78
  109. package/test/spec/modules/adlooxAnalyticsAdapter_spec.js +6 -6
  110. package/test/spec/modules/admanBidAdapter_spec.js +2 -2
  111. package/test/spec/modules/adnuntiusBidAdapter_spec.js +17 -0
  112. package/test/spec/modules/adomikAnalyticsAdapter_spec.js +9 -1
  113. package/test/spec/modules/adqueryIdSystem_spec.js +74 -0
  114. package/test/spec/modules/adxcgBidAdapter_spec.js +820 -571
  115. package/test/spec/modules/adyoulikeBidAdapter_spec.js +49 -0
  116. package/test/spec/modules/beopBidAdapter_spec.js +1 -1
  117. package/test/spec/modules/bidViewabilityIO_spec.js +2 -2
  118. package/test/spec/modules/bidViewability_spec.js +4 -4
  119. package/test/spec/modules/bliinkBidAdapter_spec.js +2 -0
  120. package/test/spec/modules/colossussspBidAdapter_spec.js +9 -0
  121. package/test/spec/modules/compassBidAdapter_spec.js +398 -0
  122. package/test/spec/modules/consentManagement_spec.js +20 -0
  123. package/test/spec/modules/criteoIdSystem_spec.js +6 -3
  124. package/test/spec/modules/cwireBidAdapter_spec.js +10 -8
  125. package/test/spec/modules/dailyhuntBidAdapter_spec.js +404 -0
  126. package/test/spec/modules/docereeBidAdapter_spec.js +9 -1
  127. package/test/spec/modules/eids_spec.js +15 -0
  128. package/test/spec/modules/feedadBidAdapter_spec.js +15 -0
  129. package/test/spec/modules/glimpseBidAdapter_spec.js +0 -18
  130. package/test/spec/modules/gptPreAuction_spec.js +177 -2
  131. package/test/spec/modules/idImportLibrary_spec.js +197 -10
  132. package/test/spec/modules/improvedigitalBidAdapter_spec.js +45 -1
  133. package/test/spec/modules/invibesBidAdapter_spec.js +119 -0
  134. package/test/spec/modules/ixBidAdapter_spec.js +112 -62
  135. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +75 -17
  136. package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +22 -0
  137. package/test/spec/modules/livewrappedBidAdapter_spec.js +31 -0
  138. package/test/spec/modules/loglyliftBidAdapter_spec.js +172 -0
  139. package/test/spec/modules/lotamePanoramaIdSystem_spec.js +227 -0
  140. package/test/spec/modules/mediasquareBidAdapter_spec.js +4 -4
  141. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +26 -1
  142. package/test/spec/modules/oguryBidAdapter_spec.js +10 -2
  143. package/test/spec/modules/optimeraRtdProvider_spec.js +14 -1
  144. package/test/spec/modules/ozoneBidAdapter_spec.js +43 -31
  145. package/test/spec/modules/prebidServerBidAdapter_spec.js +43 -0
  146. package/test/spec/modules/pubgeniusBidAdapter_spec.js +3 -3
  147. package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +13 -1
  148. package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +11 -0
  149. package/test/spec/modules/realTimeDataModule_spec.js +147 -48
  150. package/test/spec/modules/richaudienceBidAdapter_spec.js +42 -2
  151. package/test/spec/modules/riseBidAdapter_spec.js +1 -1
  152. package/test/spec/modules/rtbhouseBidAdapter_spec.js +20 -0
  153. package/test/spec/modules/rubiconBidAdapter_spec.js +65 -9
  154. package/test/spec/modules/sharedIdSystem_spec.js +52 -6
  155. package/test/spec/modules/showheroes-bsBidAdapter_spec.js +2 -0
  156. package/test/spec/modules/tappxBidAdapter_spec.js +0 -19
  157. package/test/spec/modules/targetVideoBidAdapter_spec.js +96 -0
  158. package/test/spec/modules/teadsBidAdapter_spec.js +14 -59
  159. package/test/spec/modules/userId_spec.js +68 -19
  160. package/test/spec/modules/weboramaRtdProvider_spec.js +408 -214
  161. package/test/spec/modules/welectBidAdapter_spec.js +211 -0
  162. package/test/spec/modules/yahoosspBidAdapter_spec.js +28 -1
  163. package/test/spec/modules/zeta_global_sspAnalyticsAdapter_spec.js +427 -0
  164. package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +33 -1
  165. package/test/spec/unit/core/targeting_spec.js +72 -0
  166. package/test/spec/unit/pbjs_api_spec.js +3 -1
  167. package/test/spec/utils_spec.js +38 -0
  168. package/test/test_deps.js +3 -0
  169. package/test/test_index.js +1 -3
@@ -3,15 +3,20 @@ import * as idImportlibrary from 'modules/idImportLibrary.js';
3
3
 
4
4
  var expect = require('chai').expect;
5
5
 
6
- describe('currency', function () {
7
- let fakeCurrencyFileServer;
6
+ const mockMutationObserver = {
7
+ observe: () => {
8
+ return null
9
+ }
10
+ }
11
+
12
+ describe('IdImportLibrary Tests', function () {
13
+ let fakeServer;
8
14
  let sandbox;
9
15
  let clock;
10
-
11
16
  let fn = sinon.spy();
12
17
 
13
18
  beforeEach(function () {
14
- fakeCurrencyFileServer = sinon.fakeServer.create();
19
+ fakeServer = sinon.fakeServer.create();
15
20
  sinon.stub(utils, 'logInfo');
16
21
  sinon.stub(utils, 'logError');
17
22
  });
@@ -19,7 +24,7 @@ describe('currency', function () {
19
24
  afterEach(function () {
20
25
  utils.logInfo.restore();
21
26
  utils.logError.restore();
22
- fakeCurrencyFileServer.restore();
27
+ fakeServer.restore();
23
28
  idImportlibrary.setConfig({});
24
29
  });
25
30
 
@@ -34,28 +39,210 @@ describe('currency', function () {
34
39
  clock.restore();
35
40
  });
36
41
 
37
- it('results when no config available', function () {
42
+ it('results when no config is set', function () {
43
+ idImportlibrary.setConfig();
44
+ sinon.assert.called(utils.logError);
45
+ });
46
+ it('results when config is empty', function () {
38
47
  idImportlibrary.setConfig({});
39
48
  sinon.assert.called(utils.logError);
40
49
  });
41
- it('results with config available', function () {
42
- idImportlibrary.setConfig({ 'url': 'URL' });
50
+ it('results with config available with url and debounce', function () {
51
+ idImportlibrary.setConfig({ 'url': 'URL', 'debounce': 0 });
43
52
  sinon.assert.called(utils.logInfo);
44
53
  });
54
+ it('results with config debounce ', function () {
55
+ let config = { 'url': 'URL', 'debounce': 300 }
56
+ idImportlibrary.setConfig(config);
57
+ expect(config.debounce).to.be.equal(300);
58
+ });
59
+
45
60
  it('results with config default debounce ', function () {
46
61
  let config = { 'url': 'URL' }
47
62
  idImportlibrary.setConfig(config);
48
63
  expect(config.debounce).to.be.equal(250);
49
64
  });
50
65
  it('results with config default fullscan ', function () {
51
- let config = { 'url': 'URL' }
66
+ let config = { 'url': 'URL', 'debounce': 0 }
52
67
  idImportlibrary.setConfig(config);
53
68
  expect(config.fullscan).to.be.equal(false);
54
69
  });
55
70
  it('results with config fullscan ', function () {
56
- let config = { 'url': 'URL', 'fullscan': true }
71
+ let config = { 'url': 'URL', 'fullscan': true, 'debounce': 0 }
72
+ idImportlibrary.setConfig(config);
73
+ expect(config.fullscan).to.be.equal(true);
74
+ expect(config.inputscan).to.be.equal(false);
75
+ });
76
+ it('results with config inputscan ', function () {
77
+ let config = { 'inputscan': true, 'debounce': 0 }
78
+ idImportlibrary.setConfig(config);
79
+ expect(config.inputscan).to.be.equal(true);
80
+ });
81
+ });
82
+ describe('Test with email is found', function () {
83
+ let mutationObserverStub;
84
+ let userId;
85
+ let refreshUserIdSpy;
86
+ beforeEach(function() {
87
+ let sandbox = sinon.createSandbox();
88
+ refreshUserIdSpy = sinon.spy(window.$$PREBID_GLOBAL$$, 'refreshUserIds');
89
+ clock = sinon.useFakeTimers(1046952000000); // 2003-03-06T12:00:00Z
90
+ mutationObserverStub = sinon.stub(window, 'MutationObserver').returns(mockMutationObserver);
91
+ userId = sandbox.stub(window.$$PREBID_GLOBAL$$, 'getUserIds').returns({id: {'MOCKID': '1111'}});
92
+ fakeServer.respondWith('POST', 'URL', [200,
93
+ {
94
+ 'Content-Type': 'application/json',
95
+ 'Access-Control-Allow-Origin': '*'
96
+ },
97
+ ''
98
+ ]);
99
+ });
100
+ afterEach(function () {
101
+ sandbox.restore();
102
+ clock.restore();
103
+ userId.restore();
104
+ refreshUserIdSpy.restore();
105
+ mutationObserverStub.restore();
106
+ document.body.innerHTML = '';
107
+ });
108
+
109
+ it('results with config fullscan with email found in html ', function () {
110
+ document.body.innerHTML = '<body><div>test@test.com</div></body>';
111
+ let config = { 'url': 'URL', 'fullscan': true, 'debounce': 0 }
112
+ idImportlibrary.setConfig(config);
113
+ expect(config.fullscan).to.be.equal(true);
114
+ expect(config.inputscan).to.be.equal(false);
115
+ expect(refreshUserIdSpy.calledOnce).to.equal(true);
116
+ });
117
+
118
+ it('results with config fullscan with no email found in html ', function () {
119
+ document.body.innerHTML = '<body><div>test</div></body>';
120
+ let config = { 'url': 'URL', 'fullscan': true, 'debounce': 0 }
121
+ idImportlibrary.setConfig(config);
122
+ expect(config.fullscan).to.be.equal(true);
123
+ expect(config.inputscan).to.be.equal(false);
124
+ expect(refreshUserIdSpy.calledOnce).to.equal(false);
125
+ });
126
+
127
+ it('results with config formElementId without listner ', function () {
128
+ let config = { url: 'testUrl', 'formElementId': 'userid', 'debounce': 0 }
129
+ document.body.innerHTML = '<body><input type="text" id="userid" value="test@test.com"></body>';
130
+ idImportlibrary.setConfig(config);
131
+ expect(config.formElementId).to.be.equal('userid');
132
+ expect(refreshUserIdSpy.calledOnce).to.equal(true);
133
+ });
134
+
135
+ it('results with config formElementId with listner ', function () {
136
+ let config = { url: 'testUrl', 'formElementId': 'userid', 'debounce': 0 }
137
+ document.body.innerHTML = '<body><input type="text" id="userid" value=""></body>';
138
+ idImportlibrary.setConfig(config);
139
+ expect(config.formElementId).to.be.equal('userid');
140
+ expect(refreshUserIdSpy.calledOnce).to.equal(false);
141
+ });
142
+
143
+ it('results with config target without listner ', function () {
144
+ let config = { url: 'testUrl', 'target': 'userid', 'debounce': 0 }
145
+ document.body.innerHTML = '<body><div id="userid">test@test.com<div></div></body>';
146
+ idImportlibrary.setConfig(config);
147
+ expect(config.target).to.be.equal('userid');
148
+ expect(refreshUserIdSpy.calledOnce).to.equal(true);
149
+ });
150
+ it('results with config target with listner ', function () {
151
+ let config = { url: 'testUrl', 'target': 'userid', 'debounce': 0 }
152
+ document.body.innerHTML = '<body><div id="userid"><div></div></body>';
153
+ idImportlibrary.setConfig(config);
154
+
155
+ expect(config.target).to.be.equal('userid');
156
+ expect(refreshUserIdSpy.calledOnce).to.equal(false);
157
+ });
158
+
159
+ it('results with config target with listner', function () {
160
+ let config = { url: 'testUrl', 'target': 'userid', 'debounce': 0 }
161
+ idImportlibrary.setConfig(config);
162
+ document.body.innerHTML = '<body><div id="userid">test@test.com<div></div></body>';
163
+ expect(config.target).to.be.equal('userid');
164
+ expect(refreshUserIdSpy.calledOnce).to.equal(false);
165
+ });
166
+ it('results with config fullscan ', function () {
167
+ let config = { url: 'testUrl', 'fullscan': true, 'debounce': 0 }
57
168
  idImportlibrary.setConfig(config);
169
+ document.body.innerHTML = '<body><div id="userid"><div></div></body>';
58
170
  expect(config.fullscan).to.be.equal(true);
171
+ expect(refreshUserIdSpy.calledOnce).to.equal(false);
172
+ });
173
+ it('results with config inputscan with listner', function () {
174
+ let config = { url: 'testUrl', 'inputscan': true, 'debounce': 0 }
175
+ var input = document.createElement('input');
176
+ input.setAttribute('type', 'text');
177
+ document.body.appendChild(input);
178
+ idImportlibrary.setConfig(config);
179
+ expect(config.inputscan).to.be.equal(true);
180
+ input.setAttribute('value', 'text@text.com');
181
+ const inputEvent = new InputEvent('blur');
182
+ input.dispatchEvent(inputEvent);
183
+ expect(refreshUserIdSpy.calledOnce).to.equal(true);
184
+ });
185
+
186
+ it('results with config inputscan with listner and no user ids ', function () {
187
+ let config = { 'url': 'testUrl', 'inputscan': true, 'debounce': 0 }
188
+ document.body.innerHTML = '<body><input id="userid" value=""></body>';
189
+ idImportlibrary.setConfig(config);
190
+ expect(config.inputscan).to.be.equal(true);
191
+ expect(refreshUserIdSpy.calledOnce).to.equal(false);
192
+ });
193
+
194
+ it('results with config inputscan with listner ', function () {
195
+ let config = { 'url': 'testUrl', 'inputscan': true, 'debounce': 0 }
196
+ document.body.innerHTML = '<body><input id="userid" type=text value=""></body>';
197
+ idImportlibrary.setConfig(config);
198
+ expect(config.inputscan).to.be.equal(true);
199
+ expect(refreshUserIdSpy.calledOnce).to.equal(false);
200
+ });
201
+
202
+ it('results with config inputscan without listner ', function () {
203
+ let config = { 'url': 'testUrl', 'inputscan': true, 'debounce': 0 }
204
+ document.body.innerHTML = '<body><input id="userid" value="test@test.com"></body>';
205
+ idImportlibrary.setConfig(config);
206
+ expect(config.inputscan).to.be.equal(true);
207
+ expect(refreshUserIdSpy.calledOnce).to.equal(true);
208
+ });
209
+ });
210
+ describe('Tests with no user ids', function () {
211
+ let mutationObserverStub;
212
+ let userId;
213
+ let jsonSpy;
214
+ beforeEach(function() {
215
+ let sandbox = sinon.createSandbox();
216
+ clock = sinon.useFakeTimers(1046952000000); // 2003-03-06T12:00:00Z
217
+ mutationObserverStub = sinon.stub(window, 'MutationObserver');
218
+ jsonSpy = sinon.spy(JSON, 'stringify');
219
+ fakeServer.respondWith('POST', 'URL', [200,
220
+ {
221
+ 'Content-Type': 'application/json',
222
+ 'Access-Control-Allow-Origin': '*'
223
+ },
224
+ ''
225
+ ]);
226
+ });
227
+ afterEach(function () {
228
+ sandbox.restore();
229
+ clock.restore();
230
+ jsonSpy.restore();
231
+ mutationObserverStub.restore();
232
+ });
233
+ it('results with config inputscan without listner with no user ids ', function () {
234
+ let config = { 'url': 'testUrl', 'inputscan': true, 'debounce': 0 }
235
+ document.body.innerHTML = '<body><input id="userid" value="test@test.com"></body>';
236
+ idImportlibrary.setConfig(config);
237
+ expect(config.inputscan).to.be.equal(true);
238
+ expect(jsonSpy.calledOnce).to.equal(false);
239
+ });
240
+ it('results with config inputscan without listner with no user ids ', function () {
241
+ let config = { 'url': 'testUrl', 'inputscan': true, 'debounce': 0 }
242
+ document.body.innerHTML = '<body><input id="userid"></body>';
243
+ idImportlibrary.setConfig(config);
244
+ expect(config.inputscan).to.be.equal(true);
245
+ expect(jsonSpy.calledOnce).to.equal(false);
59
246
  });
60
247
  });
61
248
  });
@@ -92,7 +92,8 @@ describe('Improve Digital Adapter Tests', function () {
92
92
  gdprConsent: {
93
93
  consentString: 'BOJ/P2HOJ/P2HABABMAAAAAZ+A==',
94
94
  vendorData: {},
95
- gdprApplies: true
95
+ gdprApplies: true,
96
+ addtlConsent: '1~1.35.41.101',
96
97
  },
97
98
  };
98
99
 
@@ -278,6 +279,7 @@ describe('Improve Digital Adapter Tests', function () {
278
279
  const request = spec.buildRequests([bidRequest], bidderRequestGdpr)[0];
279
280
  const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length)));
280
281
  expect(params.bid_request.gdpr).to.equal('BOJ/P2HOJ/P2HABABMAAAAAZ+A==');
282
+ expect(params.bid_request.user.ext.consented_providers_settings.consented_providers).to.exist.and.to.deep.equal([1, 35, 41, 101]);
281
283
  });
282
284
 
283
285
  it('should add CCPA consent string', function () {
@@ -513,6 +515,48 @@ describe('Improve Digital Adapter Tests', function () {
513
515
  });
514
516
  getConfigStub.restore();
515
517
  });
518
+
519
+ it('should set pagecat and genre ➞ fpd:ortb2.site', function() {
520
+ config.setConfig(JSON.parse('{"ortb2":{"site":{"cat":["IAB2"],"pagecat":["IAB2-2"],"content":{"genre":"Adventure"}}}}'));
521
+ const bidRequest = Object.assign({}, simpleBidRequest);
522
+ const request = spec.buildRequests([bidRequest], bidderRequestReferrer)[0];
523
+ const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length)));
524
+ expect(params.bid_request.pagecat).to.be.an('array');
525
+ expect(params.bid_request.pagecat).to.deep.equal(['IAB2-2']);
526
+ expect(params.bid_request.genre).to.be.a('string');
527
+ expect(params.bid_request.genre).be.equal('Adventure');
528
+ });
529
+
530
+ it('should not set pagecat and genre when malformed data provided ➞ fpd:ortb2.site', function() {
531
+ config.setConfig(JSON.parse('{"ortb2":{"site":{"pagecat":"IAB2-2","content":{"genre":["Adventure"]}}}}'));
532
+ const bidRequest = Object.assign({}, simpleBidRequest);
533
+ const request = spec.buildRequests([bidRequest], bidderRequestReferrer)[0];
534
+ const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length)));
535
+ expect(params.bid_request.pagecat).does.not.exist;
536
+ expect(params.bid_request.genre).does.not.exist;
537
+ });
538
+
539
+ it('should use cat when pagecat not available ➞ fpd:ortb2.site', function() {
540
+ config.setConfig(JSON.parse('{"ortb2":{"site":{"cat":["IAB2"]}}}'));
541
+ const bidRequest = Object.assign({}, simpleBidRequest);
542
+ const request = spec.buildRequests([bidRequest], bidderRequestReferrer)[0];
543
+ const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length)));
544
+ expect(params.bid_request.pagecat).to.be.an('array');
545
+ expect(params.bid_request.pagecat).to.deep.equal(['IAB2']);
546
+ });
547
+
548
+ it('should format pagecat correctly ➞ fpd:ortb2.site', function() {
549
+ config.setConfig(JSON.parse('{"ortb2":{"site":{"cat":["IAB2", ["IAB-1"], "IAB3", 123, ""]}}}'));
550
+ const bidRequest = Object.assign({}, simpleBidRequest);
551
+ const request = spec.buildRequests([bidRequest], bidderRequestReferrer)[0];
552
+ const params = JSON.parse(decodeURIComponent(request.data.substring(PARAM_PREFIX.length)));
553
+ expect(params.bid_request.pagecat).to.be.an('array');
554
+ expect(params.bid_request.pagecat).to.deep.equal([
555
+ 'IAB2',
556
+ 'IAB3'
557
+ ]
558
+ );
559
+ });
516
560
  });
517
561
 
518
562
  const serverResponse = {
@@ -158,6 +158,125 @@ describe('invibesBidAdapter:', function () {
158
158
  expect(request.method).to.equal('GET');
159
159
  });
160
160
 
161
+ it('sends bid request to custom endpoint via GET', function () {
162
+ const request = spec.buildRequests([{
163
+ bidId: 'b1',
164
+ bidder: BIDDER_CODE,
165
+ params: {
166
+ placementId: 'placement',
167
+ customEndpoint: 'sub.domain.com/Bid/VideoAdContent'
168
+ },
169
+ adUnitCode: 'test-div1'
170
+ }]);
171
+ expect(request.url).to.equal('sub.domain.com/Bid/VideoAdContent');
172
+ expect(request.method).to.equal('GET');
173
+ });
174
+
175
+ it('sends bid request to default endpoint when no placement', function () {
176
+ const request = spec.buildRequests([{
177
+ bidId: 'b1',
178
+ bidder: BIDDER_CODE,
179
+ params: {
180
+ },
181
+ adUnitCode: 'test-div1'
182
+ }]);
183
+ expect(request.url).to.equal(ENDPOINT);
184
+ expect(request.method).to.equal('GET');
185
+ });
186
+
187
+ it('sends bid request to default endpoint when null placement', function () {
188
+ const request = spec.buildRequests([{
189
+ bidId: 'b1',
190
+ bidder: BIDDER_CODE,
191
+ params: {
192
+ placementId: null
193
+ },
194
+ adUnitCode: 'test-div1'
195
+ }]);
196
+ expect(request.url).to.equal(ENDPOINT);
197
+ expect(request.method).to.equal('GET');
198
+ });
199
+
200
+ it('sends bid request to default endpoint 1 via GET', function () {
201
+ const request = spec.buildRequests([{
202
+ bidId: 'b1',
203
+ bidder: BIDDER_CODE,
204
+ params: {
205
+ placementId: 'placement'
206
+ },
207
+ adUnitCode: 'test-div1'
208
+ }]);
209
+ expect(request.url).to.equal('https://bid.videostep.com/Bid/VideoAdContent');
210
+ expect(request.method).to.equal('GET');
211
+ });
212
+
213
+ it('sends bid request to network id endpoint 1 via GET', function () {
214
+ const request = spec.buildRequests([{
215
+ bidId: 'b1',
216
+ bidder: BIDDER_CODE,
217
+ params: {
218
+ placementId: 'placement',
219
+ domainId: 1001
220
+ },
221
+ adUnitCode: 'test-div1'
222
+ }]);
223
+ expect(request.url).to.equal('https://bid.videostep.com/Bid/VideoAdContent');
224
+ expect(request.method).to.equal('GET');
225
+ });
226
+
227
+ it('sends bid request to network id endpoint 2 via GET', function () {
228
+ const request = spec.buildRequests([{
229
+ bidId: 'b1',
230
+ bidder: BIDDER_CODE,
231
+ params: {
232
+ placementId: 'placement',
233
+ domainId: 1002
234
+ },
235
+ adUnitCode: 'test-div1'
236
+ }]);
237
+ expect(request.url).to.equal('https://bid2.videostep.com/Bid/VideoAdContent');
238
+ expect(request.method).to.equal('GET');
239
+ });
240
+
241
+ it('sends bid request to network id by placement 1 via GET', function () {
242
+ const request = spec.buildRequests([{
243
+ bidId: 'b1',
244
+ bidder: BIDDER_CODE,
245
+ params: {
246
+ placementId: 'infeed_ivbs1'
247
+ },
248
+ adUnitCode: 'test-div1'
249
+ }]);
250
+ expect(request.url).to.equal('https://bid.videostep.com/Bid/VideoAdContent');
251
+ expect(request.method).to.equal('GET');
252
+ });
253
+
254
+ it('sends bid request to network id by placement 2 via GET', function () {
255
+ const request = spec.buildRequests([{
256
+ bidId: 'b1',
257
+ bidder: BIDDER_CODE,
258
+ params: {
259
+ placementId: 'infeed_ivbs2'
260
+ },
261
+ adUnitCode: 'test-div1'
262
+ }]);
263
+ expect(request.url).to.equal('https://bid2.videostep.com/Bid/VideoAdContent');
264
+ expect(request.method).to.equal('GET');
265
+ });
266
+
267
+ it('sends bid request to network id by placement 10 via GET', function () {
268
+ const request = spec.buildRequests([{
269
+ bidId: 'b1',
270
+ bidder: BIDDER_CODE,
271
+ params: {
272
+ placementId: 'infeed_ivbs10'
273
+ },
274
+ adUnitCode: 'test-div1'
275
+ }]);
276
+ expect(request.url).to.equal('https://bid10.videostep.com/Bid/VideoAdContent');
277
+ expect(request.method).to.equal('GET');
278
+ });
279
+
161
280
  it('sends cookies with the bid request', function () {
162
281
  const request = spec.buildRequests(bidRequests);
163
282
  expect(request.options.withCredentials).to.equal(true);