prebid.js 7.52.0 → 7.54.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 (236) hide show
  1. package/dist/1plusXRtdProvider.js +1 -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/adhashBidAdapter.js +1 -1
  8. package/dist/adkernelBidAdapter.js +1 -1
  9. package/dist/adqueryBidAdapter.js +1 -1
  10. package/dist/adrelevantisBidAdapter.js +1 -1
  11. package/dist/adtrgtmeBidAdapter.js +1 -1
  12. package/dist/adxcgBidAdapter.js +1 -1
  13. package/dist/adyoulikeBidAdapter.js +1 -1
  14. package/dist/airgridRtdProvider.js +1 -1
  15. package/dist/ajaBidAdapter.js +1 -1
  16. package/dist/amxBidAdapter.js +1 -1
  17. package/dist/amxIdSystem.js +1 -1
  18. package/dist/appierAnalyticsAdapter.js +1 -1
  19. package/dist/appnexusBidAdapter.js +1 -1
  20. package/dist/asoBidAdapter.js +1 -1
  21. package/dist/axonixBidAdapter.js +1 -1
  22. package/dist/beopBidAdapter.js +1 -1
  23. package/dist/bidglassBidAdapter.js +1 -1
  24. package/dist/big-richmediaBidAdapter.js +1 -1
  25. package/dist/bridgewellBidAdapter.js +1 -1
  26. package/dist/brightMountainMediaBidAdapter.js +1 -1
  27. package/dist/carodaBidAdapter.js +1 -1
  28. package/dist/chtnwBidAdapter.js +1 -1
  29. package/dist/conceptxBidAdapter.js +1 -0
  30. package/dist/concertBidAdapter.js +1 -1
  31. package/dist/connectadBidAdapter.js +1 -1
  32. package/dist/consumableBidAdapter.js +1 -1
  33. package/dist/conversantAnalyticsAdapter.js +1 -1
  34. package/dist/conversantBidAdapter.js +1 -1
  35. package/dist/craftBidAdapter.js +1 -1
  36. package/dist/criteoBidAdapter.js +1 -1
  37. package/dist/cwireBidAdapter.js +1 -1
  38. package/dist/dspxBidAdapter.js +1 -1
  39. package/dist/eplanningBidAdapter.js +1 -1
  40. package/dist/eskimiBidAdapter.js +1 -1
  41. package/dist/euidIdSystem.js +1 -0
  42. package/dist/feedadBidAdapter.js +1 -1
  43. package/dist/finativeBidAdapter.js +1 -1
  44. package/dist/freepassIdSystem.js +1 -0
  45. package/dist/freewheel-sspBidAdapter.js +1 -1
  46. package/dist/glimpseBidAdapter.js +1 -1
  47. package/dist/gmosspBidAdapter.js +1 -1
  48. package/dist/goldbachBidAdapter.js +1 -1
  49. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  50. package/dist/greenbidsRtdProvider.js +1 -1
  51. package/dist/gridBidAdapter.js +1 -1
  52. package/dist/gumgumBidAdapter.js +1 -1
  53. package/dist/h12mediaBidAdapter.js +1 -1
  54. package/dist/hypelabBidAdapter.js +1 -0
  55. package/dist/id5IdSystem.js +1 -1
  56. package/dist/improvedigitalBidAdapter.js +1 -1
  57. package/dist/inmarBidAdapter.js +1 -1
  58. package/dist/insticatorBidAdapter.js +1 -1
  59. package/dist/ixBidAdapter.js +1 -1
  60. package/dist/justpremiumBidAdapter.js +1 -1
  61. package/dist/kargoBidAdapter.js +1 -1
  62. package/dist/konduitAnalyticsAdapter.js +1 -1
  63. package/dist/kueezBidAdapter.js +1 -1
  64. package/dist/kueezRtbBidAdapter.js +1 -1
  65. package/dist/kulturemediaBidAdapter.js +1 -1
  66. package/dist/lassoBidAdapter.js +1 -1
  67. package/dist/lifestreetBidAdapter.js +1 -1
  68. package/dist/limelightDigitalBidAdapter.js +1 -1
  69. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  70. package/dist/logicadBidAdapter.js +1 -1
  71. package/dist/loglyliftBidAdapter.js +1 -1
  72. package/dist/magniteAnalyticsAdapter.js +1 -1
  73. package/dist/malltvAnalyticsAdapter.js +1 -1
  74. package/dist/marsmediaBidAdapter.js +1 -1
  75. package/dist/mediafuseBidAdapter.js +1 -1
  76. package/dist/mediasquareBidAdapter.js +1 -1
  77. package/dist/mgidBidAdapter.js +1 -1
  78. package/dist/minutemediaBidAdapter.js +1 -1
  79. package/dist/minutemediaplusBidAdapter.js +1 -1
  80. package/dist/nexx360BidAdapter.js +1 -1
  81. package/dist/not-for-prod/prebid.js +153 -148
  82. package/dist/oguryBidAdapter.js +1 -1
  83. package/dist/onetagBidAdapter.js +1 -1
  84. package/dist/ooloAnalyticsAdapter.js +1 -1
  85. package/dist/optidigitalBidAdapter.js +1 -1
  86. package/dist/outbrainBidAdapter.js +1 -1
  87. package/dist/oxxionRtdProvider.js +1 -1
  88. package/dist/pairIdSystem.js +1 -1
  89. package/dist/parrableIdSystem.js +1 -1
  90. package/dist/pixfutureBidAdapter.js +1 -1
  91. package/dist/prebid-core.js +1 -1
  92. package/dist/proxistoreBidAdapter.js +1 -1
  93. package/dist/publinkIdSystem.js +1 -1
  94. package/dist/pubmaticAnalyticsAdapter.js +1 -1
  95. package/dist/pubmaticBidAdapter.js +1 -1
  96. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  97. package/dist/pxyzBidAdapter.js +1 -1
  98. package/dist/quantcastBidAdapter.js +1 -1
  99. package/dist/readpeakBidAdapter.js +1 -1
  100. package/dist/relaidoBidAdapter.js +1 -1
  101. package/dist/retailspotBidAdapter.js +1 -1
  102. package/dist/rhythmoneBidAdapter.js +1 -1
  103. package/dist/richaudienceBidAdapter.js +1 -1
  104. package/dist/riseBidAdapter.js +1 -1
  105. package/dist/rubiconAnalyticsAdapter.js +1 -1
  106. package/dist/rubiconBidAdapter.js +1 -1
  107. package/dist/schain.js +1 -1
  108. package/dist/seedingAllianceBidAdapter.js +1 -1
  109. package/dist/seedtagBidAdapter.js +1 -1
  110. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  111. package/dist/sharethroughBidAdapter.js +1 -1
  112. package/dist/shinezBidAdapter.js +1 -1
  113. package/dist/sirdataRtdProvider.js +1 -1
  114. package/dist/smaatoBidAdapter.js +1 -1
  115. package/dist/smartadserverBidAdapter.js +1 -1
  116. package/dist/smartxBidAdapter.js +1 -1
  117. package/dist/smilewantedBidAdapter.js +1 -1
  118. package/dist/sonobiBidAdapter.js +1 -1
  119. package/dist/sovrnAnalyticsAdapter.js +1 -1
  120. package/dist/sovrnBidAdapter.js +1 -1
  121. package/dist/sspBCBidAdapter.js +1 -1
  122. package/dist/stroeerCoreBidAdapter.js +1 -1
  123. package/dist/stvBidAdapter.js +1 -1
  124. package/dist/sublimeBidAdapter.js +1 -1
  125. package/dist/synacormediaBidAdapter.js +1 -1
  126. package/dist/targetVideoBidAdapter.js +1 -1
  127. package/dist/teadsBidAdapter.js +1 -1
  128. package/dist/topicsFpdModule.js +1 -1
  129. package/dist/trionBidAdapter.js +1 -1
  130. package/dist/tripleliftBidAdapter.js +1 -1
  131. package/dist/ttdBidAdapter.js +1 -1
  132. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  133. package/dist/uid2IdSystem.js +1 -1
  134. package/dist/uid2IdSystem_shared.js +1 -0
  135. package/dist/underdogmediaBidAdapter.js +1 -1
  136. package/dist/undertoneBidAdapter.js +1 -1
  137. package/dist/userId.js +1 -1
  138. package/dist/vidazooBidAdapter.js +1 -1
  139. package/dist/videobyteBidAdapter.js +1 -1
  140. package/dist/videojsVideoProvider.js +1 -1
  141. package/dist/viouslyBidAdapter.js +1 -1
  142. package/dist/visxBidAdapter.js +1 -1
  143. package/dist/vrtcalBidAdapter.js +1 -1
  144. package/dist/vuukleBidAdapter.js +1 -1
  145. package/dist/weboramaRtdProvider.js +1 -1
  146. package/dist/widespaceBidAdapter.js +1 -1
  147. package/dist/winrBidAdapter.js +1 -1
  148. package/dist/yahoosspBidAdapter.js +1 -1
  149. package/dist/yieldlabBidAdapter.js +1 -1
  150. package/dist/yieldmoBidAdapter.js +1 -1
  151. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  152. package/dist/zeta_global_sspBidAdapter.js +1 -1
  153. package/integrationExamples/gpt/userId_example.html +20 -6
  154. package/modules/.submodules.json +3 -1
  155. package/modules/1plusXRtdProvider.js +31 -60
  156. package/modules/adagioBidAdapter.js +86 -24
  157. package/modules/adhashBidAdapter.js +56 -34
  158. package/modules/adkernelBidAdapter.js +2 -2
  159. package/modules/airgridRtdProvider.js +11 -12
  160. package/modules/asoBidAdapter.js +2 -1
  161. package/modules/beopBidAdapter.js +6 -0
  162. package/modules/conceptxBidAdapter.js +70 -0
  163. package/modules/conceptxBidAdapter.md +36 -0
  164. package/modules/criteoBidAdapter.js +9 -2
  165. package/modules/eskimiBidAdapter.js +171 -41
  166. package/modules/eskimiBidAdapter.md +35 -16
  167. package/modules/euidIdSystem.js +121 -0
  168. package/modules/euidIdSystem.md +131 -0
  169. package/modules/freepassIdSystem.js +61 -0
  170. package/modules/freepassIdSystem.md +47 -0
  171. package/modules/greenbidsAnalyticsAdapter.js +1 -1
  172. package/modules/hypelabBidAdapter.js +153 -0
  173. package/modules/hypelabBidAdapter.md +38 -0
  174. package/modules/id5IdSystem.js +3 -5
  175. package/modules/ixBidAdapter.js +12 -1
  176. package/modules/limelightDigitalBidAdapter.js +1 -1
  177. package/modules/logicadBidAdapter.js +14 -1
  178. package/modules/mediasquareBidAdapter.js +13 -5
  179. package/modules/nexx360BidAdapter.js +1 -0
  180. package/modules/oxxionRtdProvider.js +7 -29
  181. package/modules/pairIdSystem.js +10 -5
  182. package/modules/proxistoreBidAdapter.js +11 -14
  183. package/modules/pubmaticAnalyticsAdapter.js +31 -8
  184. package/modules/richaudienceBidAdapter.js +10 -1
  185. package/modules/riseBidAdapter.js +1 -1
  186. package/modules/schain.js +2 -2
  187. package/modules/sirdataRtdProvider.js +73 -146
  188. package/modules/sovrnBidAdapter.js +4 -1
  189. package/modules/stroeerCoreBidAdapter.js +55 -6
  190. package/modules/teadsBidAdapter.js +0 -1
  191. package/modules/topicsFpdModule.js +4 -1
  192. package/modules/uid2IdSystem.js +27 -210
  193. package/modules/uid2IdSystem.md +104 -23
  194. package/modules/uid2IdSystem_shared.js +232 -0
  195. package/modules/userId/eids.js +8 -0
  196. package/modules/userId/userId.md +2 -1
  197. package/modules/videojsVideoProvider.js +2 -0
  198. package/modules/viouslyBidAdapter.js +2 -2
  199. package/modules/vrtcalBidAdapter.js +5 -0
  200. package/modules/weboramaRtdProvider.js +25 -95
  201. package/modules/weboramaRtdProvider.md +4 -4
  202. package/modules/yieldlabBidAdapter.js +23 -14
  203. package/modules/zeta_global_sspBidAdapter.js +27 -22
  204. package/package.json +1 -1
  205. package/src/adloader.js +1 -0
  206. package/test/spec/modules/1plusXRtdProvider_spec.js +98 -149
  207. package/test/spec/modules/adagioBidAdapter_spec.js +46 -17
  208. package/test/spec/modules/adhashBidAdapter_spec.js +18 -2
  209. package/test/spec/modules/airgridRtdProvider_spec.js +2 -0
  210. package/test/spec/modules/beopBidAdapter_spec.js +24 -0
  211. package/test/spec/modules/conceptxBidAdapter_spec.js +136 -0
  212. package/test/spec/modules/criteoBidAdapter_spec.js +1 -1
  213. package/test/spec/modules/eids_spec.js +15 -0
  214. package/test/spec/modules/eskimiBidAdapter_spec.js +264 -112
  215. package/test/spec/modules/euidIdSystem_spec.js +130 -0
  216. package/test/spec/modules/freepassIdSystem_spec.js +186 -0
  217. package/test/spec/modules/hypelabBidAdapter_spec.js +281 -0
  218. package/test/spec/modules/id5IdSystem_spec.js +10 -3
  219. package/test/spec/modules/ixBidAdapter_spec.js +30 -0
  220. package/test/spec/modules/logicadBidAdapter_spec.js +122 -2
  221. package/test/spec/modules/mediasquareBidAdapter_spec.js +4 -0
  222. package/test/spec/modules/oxxionRtdProvider_spec.js +3 -2
  223. package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +7 -0
  224. package/test/spec/modules/richaudienceBidAdapter_spec.js +44 -0
  225. package/test/spec/modules/schain_spec.js +9 -0
  226. package/test/spec/modules/sirdataRtdProvider_spec.js +110 -17
  227. package/test/spec/modules/sovrnBidAdapter_spec.js +13 -0
  228. package/test/spec/modules/stroeerCoreBidAdapter_spec.js +151 -6
  229. package/test/spec/modules/teadsBidAdapter_spec.js +7 -0
  230. package/test/spec/modules/uid2IdSystem_helpers.js +70 -0
  231. package/test/spec/modules/uid2IdSystem_spec.js +131 -86
  232. package/test/spec/modules/userId_spec.js +16 -12
  233. package/test/spec/modules/vrtcalBidAdapter_spec.js +9 -2
  234. package/test/spec/modules/weboramaRtdProvider_spec.js +331 -205
  235. package/test/spec/modules/yieldlabBidAdapter_spec.js +42 -2
  236. package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +200 -4
@@ -0,0 +1,136 @@
1
+ // import or require modules necessary for the test, e.g.:
2
+ import { expect } from 'chai'; // may prefer 'assert' in place of 'expect'
3
+ import { spec } from 'modules/conceptxBidAdapter.js';
4
+ import { newBidder } from 'src/adapters/bidderFactory.js';
5
+ // import { config } from 'src/config.js';
6
+
7
+ describe('conceptxBidAdapter', function () {
8
+ const URL = 'https://conceptx.cncpt-central.com/openrtb';
9
+
10
+ // before(() => {
11
+
12
+ // });
13
+
14
+ // after(() => {
15
+ // // $$PREBID_GLOBAL$$.bidderSettings = {};
16
+ // });
17
+
18
+ // afterEach(function () {
19
+ // config.resetConfig();
20
+ // });
21
+
22
+ const ENDPOINT_URL = `${URL}`;
23
+ const ENDPOINT_URL_CONSENT = `${URL}?gdpr_applies=true&consentString=ihaveconsented`;
24
+ const adapter = newBidder(spec);
25
+
26
+ const bidderRequests = [
27
+ {
28
+ bidId: '123',
29
+ bidder: 'conceptx',
30
+ params: {
31
+ site: 'example',
32
+ adunit: 'some-id-3'
33
+ },
34
+ mediaTypes: {
35
+ banner: {
36
+ sizes: [[930, 180]],
37
+ }
38
+ },
39
+ }
40
+ ]
41
+
42
+ const singleBidRequest = {
43
+ bid: [
44
+ {
45
+ bidId: '123',
46
+ }
47
+ ]
48
+ }
49
+
50
+ const serverResponse = {
51
+ body: {
52
+ 'bidResponses': [
53
+ {
54
+ 'ads': [
55
+ {
56
+ 'referrer': 'http://localhost/prebidpage_concept_bidder.html',
57
+ 'ttl': 360,
58
+ 'html': '<h1>DUMMY</h1>',
59
+ 'requestId': '214dfadd1f8826',
60
+ 'cpm': 46,
61
+ 'currency': 'DKK',
62
+ 'width': 930,
63
+ 'height': 180,
64
+ 'creativeId': 'FAKE-ID',
65
+ 'meta': {
66
+ 'mediaType': 'banner'
67
+ },
68
+ 'netRevenue': true,
69
+ 'destinationUrls': {
70
+ 'destination': 'https://concept.dk'
71
+ }
72
+ }
73
+ ],
74
+ 'matchedAdCount': 1,
75
+ 'targetId': '214dfadd1f8826'
76
+ }
77
+ ]
78
+ }
79
+ }
80
+
81
+ describe('inherited functions', function () {
82
+ it('exists and is a function', function () {
83
+ expect(adapter.callBids).to.exist.and.to.be.a('function');
84
+ });
85
+ });
86
+
87
+ describe('isBidRequestValid', function () {
88
+ it('should return true when required params found', function () {
89
+ expect(spec.isBidRequestValid(bidderRequests[0])).to.equal(true);
90
+ });
91
+ });
92
+
93
+ describe('buildRequests', function () {
94
+ it('Test requests', function () {
95
+ const request = spec.buildRequests(bidderRequests, {});
96
+ expect(request.length).to.equal(1);
97
+ expect(request[0]).to.have.property('data');
98
+ const bid = JSON.parse(request[0].data).adUnits[0]
99
+ expect(bid.site).to.equal('example');
100
+ expect(bid.adunit).to.equal('some-id-3');
101
+ expect(JSON.stringify(bid.dimensions)).to.equal(JSON.stringify([
102
+ [930, 180]]));
103
+ });
104
+ });
105
+
106
+ describe('user privacy', function () {
107
+ it('should NOT send GDPR Consent data if gdprApplies equals undefined', function () {
108
+ let request = spec.buildRequests(bidderRequests, { gdprConsent: { gdprApplies: undefined, consentString: 'iDoNotConsent' } });
109
+ expect(request.length).to.equal(1);
110
+ expect(request[0]).to.have.property('url')
111
+ expect(request[0].url).to.equal(ENDPOINT_URL);
112
+ });
113
+ it('should send GDPR Consent data if gdprApplies', function () {
114
+ let request = spec.buildRequests(bidderRequests, { gdprConsent: { gdprApplies: true, consentString: 'ihaveconsented' } });
115
+ expect(request.length).to.equal(1);
116
+ expect(request[0]).to.have.property('url')
117
+ expect(request[0].url).to.equal(ENDPOINT_URL_CONSENT);
118
+ });
119
+ });
120
+
121
+ describe('interpretResponse', function () {
122
+ it('should return valid response when passed valid server response', function () {
123
+ const interpretedResponse = spec.interpretResponse(serverResponse, singleBidRequest);
124
+ const ad = serverResponse.body.bidResponses[0].ads[0]
125
+ expect(interpretedResponse).to.have.lengthOf(1);
126
+ expect(interpretedResponse[0].cpm).to.equal(ad.cpm);
127
+ expect(interpretedResponse[0].width).to.equal(Number(ad.width));
128
+ expect(interpretedResponse[0].height).to.equal(Number(ad.height));
129
+ expect(interpretedResponse[0].creativeId).to.equal(ad.creativeId);
130
+ expect(interpretedResponse[0].currency).to.equal(ad.currency);
131
+ expect(interpretedResponse[0].netRevenue).to.equal(true);
132
+ expect(interpretedResponse[0].ad).to.equal(ad.html);
133
+ expect(interpretedResponse[0].ttl).to.equal(360);
134
+ });
135
+ });
136
+ });
@@ -2457,7 +2457,7 @@ describe('The Criteo bidding adapter', function () {
2457
2457
 
2458
2458
  const adapters = { Prebid: function () { } };
2459
2459
  const adaptersMock = sinon.mock(adapters);
2460
- adaptersMock.expects('Prebid').withExactArgs(PROFILE_ID_PUBLISHERTAG, ADAPTER_VERSION, bidRequests, bidderRequest, '$prebid.version$').once().returns(prebidAdapter);
2460
+ adaptersMock.expects('Prebid').withExactArgs(PROFILE_ID_PUBLISHERTAG, ADAPTER_VERSION, bidRequests, bidderRequest, '$prebid.version$', sinon.match.any).once().returns(prebidAdapter);
2461
2461
 
2462
2462
  global.Criteo = {
2463
2463
  PubTag: {
@@ -348,6 +348,21 @@ describe('eids array generation for known sub-modules', function() {
348
348
  });
349
349
  });
350
350
 
351
+ it('euid', function() {
352
+ const userId = {
353
+ euid: {'id': 'Sample_AD_Token'}
354
+ };
355
+ const newEids = createEidsArray(userId);
356
+ expect(newEids.length).to.equal(1);
357
+ expect(newEids[0]).to.deep.equal({
358
+ source: 'euid.eu',
359
+ uids: [{
360
+ id: 'Sample_AD_Token',
361
+ atype: 3
362
+ }]
363
+ });
364
+ });
365
+
351
366
  it('kpuid', function() {
352
367
  const userId = {
353
368
  kpuid: 'Sample_Token'
@@ -1,155 +1,307 @@
1
- import {expect} from 'chai';
2
- import {spec} from 'modules/eskimiBidAdapter.js';
3
-
4
- const REQUEST = {
5
- 'bidderCode': 'eskimi',
6
- 'auctionId': 'auctionId-56a2-4f71-9098-720a68f2f708',
7
- 'bidderRequestId': 'requestId',
8
- 'bidRequest': [{
9
- 'bidder': 'eskimi',
10
- 'params': {
11
- 'placementId': 1003000,
12
- 'accId': 123
1
+ import { expect } from 'chai';
2
+ import { spec } from 'modules/eskimiBidAdapter.js';
3
+ import * as utils from 'src/utils';
4
+
5
+ const BANNER_BID = {
6
+ bidder: 'eskimi',
7
+ params: {
8
+ placementId: 1003000
9
+ },
10
+ mediaTypes: {
11
+ banner: {
12
+ sizes: [
13
+ [300, 250]
14
+ ],
13
15
  },
14
- 'sizes': [
15
- [300, 250]
16
- ],
17
- 'bidId': 'bidId1',
18
- 'adUnitCode': 'adUnitCode1',
19
- 'bidderRequestId': 'bidderRequestId',
20
- 'auctionId': 'auctionId-56a2-4f71-9098-720a68f2f708'
21
16
  },
22
- {
23
- 'bidder': 'eskimi',
24
- 'params': {
25
- 'placementId': 1003001,
26
- 'accId': 123
17
+ adUnitCode: 'adUnitCode1',
18
+ bidId: 'bidId',
19
+ bidderRequestId: 'bidderRequestId',
20
+ auctionId: 'auctionId-56a2-4f71-9098-720a68f2f708',
21
+ };
22
+
23
+ const VIDEO_BID = {
24
+ bidder: 'eskimi',
25
+ params: {
26
+ placementId: 1003000
27
+ },
28
+ mediaTypes: {
29
+ video: {
30
+ context: 'outstream',
31
+ api: [1, 2, 4, 6],
32
+ mimes: ['video/mp4'],
33
+ playbackmethod: [2, 4, 6],
34
+ playerSize: [[1024, 768]],
35
+ protocols: [3, 4, 7, 8, 10],
36
+ placement: 1,
37
+ minduration: 0,
38
+ maxduration: 60,
39
+ startdelay: 0
27
40
  },
28
- 'sizes': [
29
- [300, 250]
30
- ],
31
- 'bidId': 'bidId2',
32
- 'adUnitCode': 'adUnitCode2',
33
- 'bidderRequestId': 'bidderRequestId',
34
- 'auctionId': 'auctionId-56a2-4f71-9098-720a68f2f708'
35
- }],
36
- 'start': 1487883186070,
37
- 'auctionStart': 1487883186069,
38
- 'timeout': 3000
41
+ },
42
+ adUnitCode: 'adUnitCode1',
43
+ bidId: 'bidId',
44
+ bidderRequestId: 'bidderRequestId',
45
+ auctionId: 'auctionId-56a2-4f71-9098-720a68f2f708',
39
46
  };
40
47
 
41
- const RESPONSE = {
42
- 'headers': null,
43
- 'body': {
44
- 'id': 'requestId',
45
- 'seatbid': [
46
- {
47
- 'bid': [
48
- {
49
- 'id': 'bidId1',
50
- 'impid': 'bidId1',
51
- 'price': 0.18,
52
- 'adm': '<script>adm</script>',
53
- 'adid': '144762342',
54
- 'adomain': [
55
- 'https://dummydomain.com'
56
- ],
57
- 'iurl': 'iurl',
58
- 'cid': '109',
59
- 'crid': 'creativeId',
60
- 'cat': [],
61
- 'w': 300,
62
- 'h': 250,
63
- 'ext': {
64
- 'prebid': {
65
- 'type': 'banner'
66
- },
67
- 'bidder': {
68
- 'eskimi': {
69
- 'brand_id': 334553,
70
- 'auction_id': 514667951122925701,
71
- 'bidder_id': 2,
72
- 'bid_ad_type': 0
73
- }
74
- }
75
- }
76
- }
77
- ],
78
- 'seat': 'seat'
79
- }
80
- ]
48
+ const BIDDER_REQUEST = {
49
+ auctionId: 'auctionId-56a2-4f71-9098-720a68f2f708',
50
+ bidderRequestId: 'bidderRequestId',
51
+ timeout: 3000,
52
+ refererInfo: {
53
+ page: 'https://hello-world-page.com/',
54
+ domain: 'hello-world-page.com',
55
+ ref: 'http://example-domain.com/foo',
81
56
  }
82
57
  };
83
58
 
59
+ const BANNER_BID_RESPONSE = {
60
+ 'id': 'bidderRequestId',
61
+ 'bidId': 'bidid',
62
+ 'seatbid': [
63
+ {
64
+ 'bid': [
65
+ {
66
+ 'id': 'id',
67
+ 'impid': 'bidId',
68
+ 'price': 0.18,
69
+ 'adm': '<script>adm</script>',
70
+ 'adid': '144762342',
71
+ 'burl': 'http://0.0.0.0:8181/burl',
72
+ 'adomain': [
73
+ 'https://dummydomain.com'
74
+ ],
75
+ 'cid': 'cid',
76
+ 'crid': 'crid',
77
+ 'iurl': 'iurl',
78
+ 'cat': [],
79
+ 'w': 300,
80
+ 'h': 250
81
+ }
82
+ ]
83
+ }
84
+ ],
85
+ 'cur': 'USD'
86
+ };
87
+
88
+ const VIDEO_BID_RESPONSE = {
89
+ 'id': 'bidderRequestId',
90
+ 'bidid': 'bidid',
91
+ 'seatbid': [
92
+ {
93
+ 'bid': [
94
+ {
95
+ 'id': 'id',
96
+ 'impid': 'bidId',
97
+ 'price': 1.09,
98
+ 'adid': '144762342',
99
+ 'burl': 'http://0.0.0.0:8181/burl',
100
+ 'adm': '<VAST version="4.2"></VAST>',
101
+ 'adomain': [
102
+ 'https://dummydomain.com'
103
+ ],
104
+ 'cid': 'cid',
105
+ 'crid': 'crid',
106
+ 'iurl': 'iurl',
107
+ 'cat': [],
108
+ 'h': 768,
109
+ 'w': 1024
110
+ }
111
+ ]
112
+ }
113
+ ],
114
+ 'cur': 'USD'
115
+ };
116
+
84
117
  describe('Eskimi bid adapter', function () {
85
- describe('isBidRequestValid', function () {
118
+ describe('isBidRequestValid()', function () {
86
119
  it('should accept request if placementId is passed', function () {
87
120
  let bid = {
88
121
  bidder: 'eskimi',
89
122
  params: {
90
123
  placementId: 123
124
+ },
125
+ mediaTypes: {
126
+ banner: {
127
+ sizes: [[300, 250]]
128
+ }
91
129
  }
92
130
  };
93
131
  expect(spec.isBidRequestValid(bid)).to.equal(true);
94
132
  });
95
- it('reject requests without params', function () {
133
+
134
+ it('should reject requests without params', function () {
96
135
  let bid = {
97
136
  bidder: 'eskimi',
98
137
  params: {}
99
138
  };
100
139
  expect(spec.isBidRequestValid(bid)).to.equal(false);
101
140
  });
102
- });
103
141
 
104
- describe('buildRequests', function () {
105
- it('creates request data', function () {
106
- let request = spec.buildRequests(REQUEST.bidRequest, REQUEST)[0];
107
- expect(request).to.exist.and.to.be.a('object');
108
- const payload = request.data;
109
- expect(payload.imp[0]).to.have.property('id', REQUEST.bidRequest[0].bidId);
110
- expect(payload.imp[1]).to.have.property('id', REQUEST.bidRequest[1].bidId);
142
+ it('should return true when required params found', () => {
143
+ expect(spec.isBidRequestValid(BANNER_BID)).to.equal(true);
144
+ expect(spec.isBidRequestValid(VIDEO_BID)).to.equal(true);
111
145
  });
146
+ });
112
147
 
113
- it('has gdpr data if applicable', function () {
114
- const req = Object.assign({}, REQUEST, {
148
+ describe('buildRequests()', function () {
149
+ it('should have gdpr data if applicable', function () {
150
+ const bid = utils.deepClone(BANNER_BID);
151
+
152
+ const req = Object.assign({}, BIDDER_REQUEST, {
115
153
  gdprConsent: {
116
154
  consentString: 'consentString',
117
155
  gdprApplies: true,
118
156
  }
119
157
  });
120
- let request = spec.buildRequests(REQUEST.bidRequest, req)[0];
158
+ let request = spec.buildRequests([bid], req)[0];
121
159
 
122
160
  const payload = request.data;
123
161
  expect(payload.user.ext).to.have.property('consent', req.gdprConsent.consentString);
124
162
  expect(payload.regs.ext).to.have.property('gdpr', 1);
125
163
  });
126
- });
127
164
 
128
- describe('interpretResponse', function () {
129
- it('has bids', function () {
130
- let request = spec.buildRequests(REQUEST.bidRequest, REQUEST)[0];
131
- let bids = spec.interpretResponse(RESPONSE, request);
132
- expect(bids).to.be.an('array').that.is.not.empty;
133
- validateBidOnIndex(0);
134
-
135
- function validateBidOnIndex(index) {
136
- expect(bids[index]).to.have.property('currency', 'USD');
137
- expect(bids[index]).to.have.property('requestId', RESPONSE.body.seatbid[0].bid[index].id);
138
- expect(bids[index]).to.have.property('cpm', RESPONSE.body.seatbid[0].bid[index].price);
139
- expect(bids[index]).to.have.property('width', RESPONSE.body.seatbid[0].bid[index].w);
140
- expect(bids[index]).to.have.property('height', RESPONSE.body.seatbid[0].bid[index].h);
141
- expect(bids[index]).to.have.property('ad', RESPONSE.body.seatbid[0].bid[index].adm);
142
- expect(bids[index]).to.have.property('creativeId', RESPONSE.body.seatbid[0].bid[index].crid);
143
- expect(bids[index]).to.have.property('ttl', 30);
144
- expect(bids[index]).to.have.property('netRevenue', true);
145
- }
165
+ it('should properly forward ORTB blocking params', function () {
166
+ let bid = utils.deepClone(BANNER_BID);
167
+ bid = utils.mergeDeep(bid, {
168
+ params: { bcat: ['IAB1-1'], badv: ['example.com'], bapp: ['com.example'] },
169
+ mediaTypes: { banner: { battr: [1] } }
170
+ });
171
+
172
+ let [request] = spec.buildRequests([bid], BIDDER_REQUEST);
173
+
174
+ expect(request).to.exist.and.to.be.an('object');
175
+ const payload = request.data;
176
+ expect(payload).to.have.deep.property('bcat', ['IAB1-1']);
177
+ expect(payload).to.have.deep.property('badv', ['example.com']);
178
+ expect(payload).to.have.deep.property('bapp', ['com.example']);
179
+ expect(payload.imp[0].banner).to.have.deep.property('battr', [1]);
180
+ });
181
+
182
+ context('when mediaType is banner', function () {
183
+ it('should build correct request for banner bid with both w, h', () => {
184
+ const bid = utils.deepClone(BANNER_BID);
185
+
186
+ const [request] = spec.buildRequests([bid], BIDDER_REQUEST);
187
+ const requestData = request.data;
188
+
189
+ expect(requestData.imp[0].banner.w).to.equal(300);
190
+ expect(requestData.imp[0].banner.h).to.equal(250);
191
+ });
192
+
193
+ it('should create request data', function () {
194
+ const bid = utils.deepClone(BANNER_BID);
195
+
196
+ let [request] = spec.buildRequests([bid], BIDDER_REQUEST);
197
+ expect(request).to.exist.and.to.be.a('object');
198
+ const payload = request.data;
199
+ expect(payload.imp[0]).to.have.property('id', bid.bidId);
200
+ });
146
201
  });
147
202
 
148
- it('handles empty response', function () {
149
- let request = spec.buildRequests(REQUEST.bidRequest, REQUEST)[0];
150
- const EMPTY_RESP = Object.assign({}, RESPONSE, {'body': {}});
151
- const bids = spec.interpretResponse(EMPTY_RESP, request);
152
- expect(bids).to.be.empty;
203
+ context('when mediaType is video', function () {
204
+ it('should return false when there is no video in mediaTypes', () => {
205
+ const bid = utils.deepClone(VIDEO_BID);
206
+ delete bid.mediaTypes.video;
207
+
208
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
209
+ });
210
+
211
+ it('should reutrn false if player size is not set', () => {
212
+ const bid = utils.deepClone(VIDEO_BID);
213
+ delete bid.mediaTypes.video.playerSize;
214
+
215
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
216
+ });
217
+
218
+ it('should use bidder video params if they are set', () => {
219
+ const videoBidWithParams = utils.deepClone(VIDEO_BID);
220
+ const bidderVideoParams = {
221
+ api: [1, 2],
222
+ mimes: ['video/mp4', 'video/x-flv'],
223
+ playbackmethod: [3, 4],
224
+ protocols: [5, 6],
225
+ placement: 1,
226
+ minduration: 0,
227
+ maxduration: 60,
228
+ w: 1024,
229
+ h: 768,
230
+ startdelay: 0
231
+ };
232
+
233
+ videoBidWithParams.params.video = bidderVideoParams;
234
+
235
+ const requests = spec.buildRequests([videoBidWithParams], BIDDER_REQUEST);
236
+ const request = requests[0].data;
237
+
238
+ expect(request.imp[0]).to.deep.include({
239
+ video: {
240
+ ...bidderVideoParams,
241
+ w: videoBidWithParams.mediaTypes.video.playerSize[0][0],
242
+ h: videoBidWithParams.mediaTypes.video.playerSize[0][1],
243
+ },
244
+ });
245
+ });
153
246
  });
154
247
  });
248
+
249
+ describe('interpretResponse()', function () {
250
+ context('when mediaType is banner', function () {
251
+ it('should correctly interpret valid banner response', function () {
252
+ const bid = utils.deepClone(BANNER_BID);
253
+ const [request] = spec.buildRequests([bid], BIDDER_REQUEST);
254
+ const response = utils.deepClone(BANNER_BID_RESPONSE);
255
+
256
+ const bids = spec.interpretResponse({ body: response }, request);
257
+ expect(bids).to.be.an('array').that.is.not.empty;
258
+
259
+ expect(bids[0].mediaType).to.equal('banner');
260
+ expect(bids[0].burl).to.equal(BANNER_BID_RESPONSE.seatbid[0].bid[0].burl);
261
+ expect(bids[0].currency).to.equal('USD');
262
+ expect(bids[0].requestId).to.equal(BANNER_BID_RESPONSE.seatbid[0].bid[0].impid);
263
+ expect(bids[0].cpm).to.equal(BANNER_BID_RESPONSE.seatbid[0].bid[0].price);
264
+ expect(bids[0].width).to.equal(BANNER_BID_RESPONSE.seatbid[0].bid[0].w);
265
+ expect(bids[0].height).to.equal(BANNER_BID_RESPONSE.seatbid[0].bid[0].h);
266
+ expect(bids[0].ad).to.equal(BANNER_BID_RESPONSE.seatbid[0].bid[0].adm);
267
+ expect(bids[0].creativeId).to.equal(BANNER_BID_RESPONSE.seatbid[0].bid[0].crid);
268
+ expect(bids[0].meta.advertiserDomains[0]).to.equal('https://dummydomain.com');
269
+ expect(bids[0].ttl).to.equal(30);
270
+ expect(bids[0].netRevenue).to.equal(true);
271
+ });
272
+
273
+ it('should handle empty bid response', function () {
274
+ const bid = utils.deepClone(BANNER_BID);
275
+
276
+ let request = spec.buildRequests([bid], BIDDER_REQUEST)[0];
277
+ const EMPTY_RESP = Object.assign({}, BANNER_BID_RESPONSE, { 'body': {} });
278
+ const bids = spec.interpretResponse(EMPTY_RESP, request);
279
+ expect(bids).to.be.empty;
280
+ });
281
+ });
282
+ if (FEATURES.VIDEO) {
283
+ context('when mediaType is video', function () {
284
+ it('should correctly interpret valid instream video response', () => {
285
+ const bid = utils.deepClone(VIDEO_BID);
286
+
287
+ const [request] = spec.buildRequests([bid], BIDDER_REQUEST);
288
+ const bids = spec.interpretResponse({ body: VIDEO_BID_RESPONSE }, request);
289
+ expect(bids).to.be.an('array').that.is.not.empty;
290
+
291
+ expect(bids[0].mediaType).to.equal('video');
292
+ expect(bids[0].burl).to.equal(VIDEO_BID_RESPONSE.seatbid[0].bid[0].burl);
293
+ expect(bids[0].currency).to.equal('USD');
294
+ expect(bids[0].requestId).to.equal(VIDEO_BID_RESPONSE.seatbid[0].bid[0].impid);
295
+ expect(bids[0].cpm).to.equal(VIDEO_BID_RESPONSE.seatbid[0].bid[0].price);
296
+ expect(bids[0].width).to.equal(VIDEO_BID_RESPONSE.seatbid[0].bid[0].w);
297
+ expect(bids[0].height).to.equal(VIDEO_BID_RESPONSE.seatbid[0].bid[0].h);
298
+ expect(bids[0].vastXml).to.equal(VIDEO_BID_RESPONSE.seatbid[0].bid[0].adm);
299
+ expect(bids[0].creativeId).to.equal(VIDEO_BID_RESPONSE.seatbid[0].bid[0].crid);
300
+ expect(bids[0].meta.advertiserDomains[0]).to.equal('https://dummydomain.com');
301
+ expect(bids[0].ttl).to.equal(30);
302
+ expect(bids[0].netRevenue).to.equal(true);
303
+ });
304
+ });
305
+ }
306
+ });
155
307
  });