prebid.js 6.5.0 → 6.9.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 (139) hide show
  1. package/.eslintrc.js +8 -1
  2. package/integrationExamples/gpt/amp/creative.html +11 -33
  3. package/integrationExamples/gpt/weboramaRtdProvider_example.html +154 -115
  4. package/integrationExamples/gpt/x-domain/creative.html +63 -29
  5. package/modules/.submodules.json +2 -1
  6. package/modules/adagioBidAdapter.js +0 -8
  7. package/modules/adagioBidAdapter.md +1 -1
  8. package/modules/adbookpspBidAdapter.js +27 -10
  9. package/modules/adhashBidAdapter.js +3 -3
  10. package/modules/adkernelBidAdapter.js +2 -1
  11. package/modules/admanBidAdapter.js +10 -4
  12. package/modules/adomikAnalyticsAdapter.js +23 -11
  13. package/modules/adqueryIdSystem.js +103 -0
  14. package/modules/adqueryIdSystem.md +35 -0
  15. package/modules/appnexusBidAdapter.js +14 -2
  16. package/modules/asealBidAdapter.js +58 -0
  17. package/modules/asealBidAdapter.md +52 -0
  18. package/modules/bliinkBidAdapter.js +2 -1
  19. package/modules/brandmetricsRtdProvider.js +168 -0
  20. package/modules/brandmetricsRtdProvider.md +40 -0
  21. package/modules/colossussspBidAdapter.js +12 -8
  22. package/modules/colossussspBidAdapter.md +15 -1
  23. package/modules/compassBidAdapter.js +10 -3
  24. package/modules/consumableBidAdapter.md +1 -1
  25. package/modules/conversantBidAdapter.js +7 -0
  26. package/modules/criteoBidAdapter.js +10 -1
  27. package/modules/criteoIdSystem.js +29 -7
  28. package/modules/currency.js +26 -1
  29. package/modules/displayioBidAdapter.js +157 -0
  30. package/modules/displayioBidAdapter.md +148 -0
  31. package/modules/e_volutionBidAdapter.js +158 -0
  32. package/modules/glimpseBidAdapter.js +66 -44
  33. package/modules/gnetBidAdapter.js +3 -3
  34. package/modules/gnetBidAdapter.md +4 -4
  35. package/modules/gumgumBidAdapter.js +56 -42
  36. package/modules/idImportLibrary.js +45 -8
  37. package/modules/idImportLibrary.md +4 -0
  38. package/modules/improvedigitalBidAdapter.js +29 -2
  39. package/modules/interactiveOffersBidAdapter.js +9 -6
  40. package/modules/jwplayerRtdProvider.js +71 -6
  41. package/modules/jwplayerRtdProvider.md +27 -11
  42. package/modules/kargoBidAdapter.js +2 -2
  43. package/modules/lunamediahbBidAdapter.js +32 -4
  44. package/modules/nextMillenniumBidAdapter.js +3 -1
  45. package/modules/oguryBidAdapter.js +14 -14
  46. package/modules/onetagBidAdapter.js +4 -2
  47. package/modules/pilotxBidAdapter.js +147 -0
  48. package/modules/pilotxBidAdapter.md +50 -0
  49. package/modules/priceFloors.js +2 -1
  50. package/modules/proxistoreBidAdapter.js +0 -2
  51. package/modules/pubmaticAnalyticsAdapter.js +16 -0
  52. package/modules/richaudienceBidAdapter.js +10 -4
  53. package/modules/riseBidAdapter.js +18 -7
  54. package/modules/rtbhouseBidAdapter.js +14 -4
  55. package/modules/rtdModule/index.js +14 -15
  56. package/modules/rubiconAnalyticsAdapter.js +8 -2
  57. package/modules/seedingAllianceBidAdapter.js +3 -3
  58. package/modules/sharethroughBidAdapter.js +12 -17
  59. package/modules/showheroes-bsBidAdapter.js +13 -2
  60. package/modules/sortableAnalyticsAdapter.js +5 -4
  61. package/modules/sovrnBidAdapter.js +93 -18
  62. package/modules/sovrnBidAdapter.md +80 -2
  63. package/modules/synacormediaBidAdapter.js +31 -10
  64. package/modules/tappxBidAdapter.js +8 -5
  65. package/modules/teadsBidAdapter.js +1 -2
  66. package/modules/undertoneBidAdapter.js +17 -1
  67. package/modules/userId/eids.js +7 -1
  68. package/modules/userId/userId.md +8 -0
  69. package/modules/viewability.js +177 -0
  70. package/modules/viewability.md +87 -0
  71. package/modules/weboramaRtdProvider.js +264 -34
  72. package/modules/weboramaRtdProvider.md +110 -40
  73. package/modules/welectBidAdapter.js +106 -0
  74. package/modules/yahoosspBidAdapter.js +2 -0
  75. package/package.json +2 -1
  76. package/src/adRendering.js +38 -0
  77. package/src/adloader.js +2 -1
  78. package/src/auction.js +103 -73
  79. package/src/bidderSettings.js +69 -0
  80. package/src/hook.js +5 -1
  81. package/src/prebid.js +19 -21
  82. package/src/secureCreatives.js +131 -47
  83. package/src/targeting.js +3 -2
  84. package/src/utils.js +13 -10
  85. package/test/helpers/syncPromise.js +71 -0
  86. package/test/spec/auctionmanager_spec.js +179 -15
  87. package/test/spec/modules/adagioBidAdapter_spec.js +0 -10
  88. package/test/spec/modules/adbookpspBidAdapter_spec.js +17 -3
  89. package/test/spec/modules/adhashBidAdapter_spec.js +2 -2
  90. package/test/spec/modules/admanBidAdapter_spec.js +2 -2
  91. package/test/spec/modules/adomikAnalyticsAdapter_spec.js +3 -1
  92. package/test/spec/modules/adqueryIdSystem_spec.js +74 -0
  93. package/test/spec/modules/appnexusBidAdapter_spec.js +27 -0
  94. package/test/spec/modules/asealBidAdapter_spec.js +144 -0
  95. package/test/spec/modules/bliinkBidAdapter_spec.js +2 -0
  96. package/test/spec/modules/brandmetricsRtdProvider_spec.js +191 -0
  97. package/test/spec/modules/colossussspBidAdapter_spec.js +5 -2
  98. package/test/spec/modules/compassBidAdapter_spec.js +1 -0
  99. package/test/spec/modules/conversantBidAdapter_spec.js +54 -2
  100. package/test/spec/modules/criteoBidAdapter_spec.js +21 -0
  101. package/test/spec/modules/criteoIdSystem_spec.js +6 -3
  102. package/test/spec/modules/currency_spec.js +21 -6
  103. package/test/spec/modules/displayioBidAdapter_spec.js +239 -0
  104. package/test/spec/modules/e_volutionBidAdapter_spec.js +242 -0
  105. package/test/spec/modules/eids_spec.js +15 -0
  106. package/test/spec/modules/glimpseBidAdapter_spec.js +0 -18
  107. package/test/spec/modules/gnetBidAdapter_spec.js +6 -6
  108. package/test/spec/modules/gumgumBidAdapter_spec.js +46 -0
  109. package/test/spec/modules/idImportLibrary_spec.js +197 -10
  110. package/test/spec/modules/improvedigitalBidAdapter_spec.js +61 -0
  111. package/test/spec/modules/jwplayerRtdProvider_spec.js +195 -2
  112. package/test/spec/modules/kargoBidAdapter_spec.js +1 -1
  113. package/test/spec/modules/loglyliftBidAdapter_spec.js +1 -1
  114. package/test/spec/modules/lunamediahbBidAdapter_spec.js +27 -1
  115. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +1 -1
  116. package/test/spec/modules/oguryBidAdapter_spec.js +69 -3
  117. package/test/spec/modules/pilotxBidAdapter_spec.js +244 -0
  118. package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +13 -1
  119. package/test/spec/modules/realTimeDataModule_spec.js +67 -5
  120. package/test/spec/modules/richaudienceBidAdapter_spec.js +40 -0
  121. package/test/spec/modules/riseBidAdapter_spec.js +31 -5
  122. package/test/spec/modules/rtbhouseBidAdapter_spec.js +20 -0
  123. package/test/spec/modules/rubiconAnalyticsAdapter_spec.js +61 -1
  124. package/test/spec/modules/sharethroughBidAdapter_spec.js +91 -6
  125. package/test/spec/modules/showheroes-bsBidAdapter_spec.js +2 -0
  126. package/test/spec/modules/sortableAnalyticsAdapter_spec.js +2 -3
  127. package/test/spec/modules/sovrnBidAdapter_spec.js +413 -333
  128. package/test/spec/modules/synacormediaBidAdapter_spec.js +70 -0
  129. package/test/spec/modules/tappxBidAdapter_spec.js +0 -19
  130. package/test/spec/modules/teadsBidAdapter_spec.js +14 -59
  131. package/test/spec/modules/undertoneBidAdapter_spec.js +55 -2
  132. package/test/spec/modules/userId_spec.js +68 -19
  133. package/test/spec/modules/viewability_spec.js +280 -0
  134. package/test/spec/modules/weboramaRtdProvider_spec.js +536 -20
  135. package/test/spec/modules/welectBidAdapter_spec.js +211 -0
  136. package/test/spec/modules/yahoosspBidAdapter_spec.js +10 -0
  137. package/test/spec/unit/core/bidderSettings_spec.js +123 -0
  138. package/test/spec/unit/pbjs_api_spec.js +21 -8
  139. package/test/spec/unit/secureCreatives_spec.js +143 -24
@@ -5,7 +5,7 @@ import * as utils from 'src/utils.js'
5
5
 
6
6
  const ENDPOINT = `https://ap.lijit.com/rtb/bid?src=$$REPO_AND_VERSION$$`;
7
7
 
8
- const adUnitBidRequest = {
8
+ const baseBidRequest = {
9
9
  'bidder': 'sovrn',
10
10
  'params': {
11
11
  'tagid': 403370
@@ -19,7 +19,7 @@ const adUnitBidRequest = {
19
19
  'bidderRequestId': '22edbae2733bf6',
20
20
  'auctionId': '1d1a030790a475',
21
21
  }
22
- const bidderRequest = {
22
+ const baseBidderRequest = {
23
23
  refererInfo: {
24
24
  referer: 'http://example.com/page.html',
25
25
  }
@@ -28,28 +28,35 @@ const bidderRequest = {
28
28
  describe('sovrnBidAdapter', function() {
29
29
  describe('isBidRequestValid', function () {
30
30
  it('should return true when required params found', function () {
31
- expect(spec.isBidRequestValid(adUnitBidRequest)).to.equal(true);
31
+ expect(spec.isBidRequestValid(baseBidRequest)).to.equal(true);
32
32
  });
33
33
 
34
34
  it('should return false when tagid not passed correctly', function () {
35
- const bid = {...adUnitBidRequest}
36
- const params = adUnitBidRequest.params
37
- bid.params = {...params}
38
- bid.params.tagid = 'ABCD'
39
- expect(spec.isBidRequestValid(bid)).to.equal(false)
35
+ const bidRequest = {
36
+ ...baseBidRequest,
37
+ 'params': {
38
+ ...baseBidRequest.params,
39
+ 'tagid': 'ABCD'
40
+ },
41
+ };
42
+
43
+ expect(spec.isBidRequestValid(bidRequest)).to.equal(false);
40
44
  });
41
45
 
42
46
  it('should return false when require params are not passed', function () {
43
- const bid = {...adUnitBidRequest}
44
- bid.params = {};
45
- expect(spec.isBidRequestValid(bid)).to.equal(false);
47
+ const bidRequest = {
48
+ ...baseBidRequest,
49
+ 'params': {}
50
+ }
51
+
52
+ expect(spec.isBidRequestValid(bidRequest)).to.equal(false);
46
53
  });
47
54
  });
48
55
 
49
56
  describe('buildRequests', function () {
50
57
  describe('basic bid parameters', function() {
51
- const bidRequests = [adUnitBidRequest];
52
- const request = spec.buildRequests(bidRequests, bidderRequest);
58
+ const request = spec.buildRequests([baseBidRequest], baseBidderRequest);
59
+ const payload = JSON.parse(request.data);
53
60
 
54
61
  it('sends bid request to our endpoint via POST', function () {
55
62
  expect(request.method).to.equal('POST');
@@ -60,15 +67,65 @@ describe('sovrnBidAdapter', function() {
60
67
  });
61
68
 
62
69
  it('sets the proper banner object', function() {
70
+ const bannerBidRequest = {
71
+ ...baseBidRequest,
72
+ 'mediaTypes': {
73
+ banner: {}
74
+ }
75
+ }
76
+ const request = spec.buildRequests([bannerBidRequest], baseBidderRequest)
77
+
78
+ const payload = JSON.parse(request.data)
79
+ const impression = payload.imp[0]
80
+
81
+ expect(impression.banner.format).to.deep.equal([{w: 300, h: 250}, {w: 300, h: 600}])
82
+ expect(impression.banner.w).to.equal(1)
83
+ expect(impression.banner.h).to.equal(1)
84
+ })
85
+
86
+ it('sets the proper video object', function() {
87
+ const width = 640
88
+ const height = 480
89
+ const mimes = ['video/mp4', 'application/javascript']
90
+ const protocols = [2, 5]
91
+ const minduration = 5
92
+ const maxduration = 60
93
+ const startdelay = 0
94
+ const videoBidRequest = {
95
+ ...baseBidRequest,
96
+ 'mediaTypes': {
97
+ video: {
98
+ mimes,
99
+ protocols,
100
+ playerSize: [[width, height], [360, 240]],
101
+ minduration,
102
+ maxduration,
103
+ startdelay
104
+ }
105
+ }
106
+ }
107
+ const request = spec.buildRequests([videoBidRequest], baseBidderRequest)
108
+
63
109
  const payload = JSON.parse(request.data)
64
- expect(payload.imp[0].banner.format).to.deep.equal([{w: 300, h: 250}, {w: 300, h: 600}])
65
- expect(payload.imp[0].banner.w).to.equal(1)
66
- expect(payload.imp[0].banner.h).to.equal(1)
110
+ const impression = payload.imp[0]
111
+
112
+ expect(impression.video.w).to.equal(width)
113
+ expect(impression.video.h).to.equal(height)
114
+ expect(impression.video.mimes).to.have.same.members(mimes)
115
+ expect(impression.video.protocols).to.have.same.members(protocols)
116
+ expect(impression.video.minduration).to.equal(minduration)
117
+ expect(impression.video.maxduration).to.equal(maxduration)
118
+ expect(impression.video.startdelay).to.equal(startdelay)
67
119
  })
68
120
 
69
- it('includes the ad unit code int the request', function() {
70
- const payload = JSON.parse(request.data);
71
- expect(payload.imp[0].adunitcode).to.equal('adunit-code')
121
+ it('gets correct site info', function() {
122
+ expect(payload.site.page).to.equal('http://example.com/page.html');
123
+ expect(payload.site.domain).to.equal('example.com');
124
+ });
125
+
126
+ it('includes the ad unit code in the request', function() {
127
+ const impression = payload.imp[0]
128
+ expect(impression.adunitcode).to.equal('adunit-code')
72
129
  })
73
130
 
74
131
  it('converts tagid to string', function () {
@@ -77,109 +134,79 @@ describe('sovrnBidAdapter', function() {
77
134
  })
78
135
 
79
136
  it('accepts a single array as a size', function() {
80
- const singleSize = [{
81
- 'bidder': 'sovrn',
137
+ const singleSizeBidRequest = {
138
+ ...baseBidRequest,
82
139
  'params': {
83
- 'tagid': '403370',
84
140
  'iv': 'vet'
85
141
  },
86
- 'adUnitCode': 'adunit-code',
87
142
  'sizes': [300, 250],
88
- 'bidId': '30b31c1838de1e',
89
- 'bidderRequestId': '22edbae2733bf6',
90
- 'auctionId': '1d1a030790a475'
91
- }]
92
- const request = spec.buildRequests(singleSize, bidderRequest)
143
+ 'mediaTypes': {
144
+ banner: {}
145
+ },
146
+ }
147
+ const request = spec.buildRequests([singleSizeBidRequest], baseBidderRequest)
148
+
93
149
  const payload = JSON.parse(request.data)
94
- expect(payload.imp[0].banner.format).to.deep.equal([{w: 300, h: 250}])
95
- expect(payload.imp[0].banner.w).to.equal(1)
96
- expect(payload.imp[0].banner.h).to.equal(1)
150
+ const impression = payload.imp[0]
151
+
152
+ expect(impression.banner.format).to.deep.equal([{w: 300, h: 250}])
153
+ expect(impression.banner.w).to.equal(1)
154
+ expect(impression.banner.h).to.equal(1)
97
155
  })
98
156
 
99
157
  it('sends \'iv\' as query param if present', function () {
100
- const ivBidRequests = [{
101
- 'bidder': 'sovrn',
102
- 'params': {
103
- 'tagid': '403370',
104
- 'iv': 'vet'
105
- },
106
- 'adUnitCode': 'adunit-code',
107
- 'sizes': [
108
- [300, 250],
109
- [300, 600]
110
- ],
111
- 'bidId': '30b31c1838de1e',
112
- 'bidderRequestId': '22edbae2733bf6',
113
- 'auctionId': '1d1a030790a475'
114
- }];
115
- const bidderRequest = {
116
- refererInfo: {
117
- referer: 'http://example.com/page.html',
158
+ const ivBidRequest = {
159
+ ...baseBidRequest,
160
+ params: {
161
+ iv: 'vet'
118
162
  }
119
- };
120
- const request = spec.buildRequests(ivBidRequests, bidderRequest);
163
+ }
164
+ const request = spec.buildRequests([ivBidRequest], baseBidderRequest)
121
165
 
122
166
  expect(request.url).to.contain('iv=vet')
123
167
  });
124
168
 
125
169
  it('sends gdpr info if exists', function () {
126
- let consentString = 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A==';
127
170
  const bidderRequest = {
171
+ ...baseBidderRequest,
128
172
  'bidderCode': 'sovrn',
129
173
  'auctionId': '1d1a030790a475',
130
174
  'bidderRequestId': '22edbae2733bf6',
131
175
  'timeout': 3000,
132
- gdprConsent: {
133
- consentString: consentString,
134
- gdprApplies: true
176
+ 'gdprConsent': {
177
+ 'consentString': 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A==',
178
+ 'gdprApplies': true
135
179
  },
136
- refererInfo: {
137
- referer: 'http://example.com/page.html',
138
- }
180
+ 'bids': [baseBidRequest]
139
181
  };
140
- bidderRequest.bids = [adUnitBidRequest];
141
182
 
142
- const data = JSON.parse(spec.buildRequests([adUnitBidRequest], bidderRequest).data);
183
+ const { regs, user } = JSON.parse(spec.buildRequests([baseBidRequest], bidderRequest).data)
143
184
 
144
- expect(data.regs.ext.gdpr).to.exist.and.to.be.a('number');
145
- expect(data.regs.ext.gdpr).to.equal(1);
146
- expect(data.user.ext.consent).to.exist.and.to.be.a('string');
147
- expect(data.user.ext.consent).to.equal(consentString);
148
- });
185
+ expect(regs.ext.gdpr).to.exist.and.to.be.a('number')
186
+ expect(regs.ext.gdpr).to.equal(1)
187
+ expect(user.ext.consent).to.exist.and.to.be.a('string')
188
+ expect(user.ext.consent).to.equal(bidderRequest.gdprConsent.consentString)
189
+ })
149
190
 
150
191
  it('should send us_privacy if bidderRequest has a value for uspConsent', function () {
151
- const uspString = '1NYN';
152
192
  const bidderRequest = {
193
+ ...baseBidderRequest,
153
194
  'bidderCode': 'sovrn',
154
195
  'auctionId': '1d1a030790a475',
155
196
  'bidderRequestId': '22edbae2733bf6',
156
197
  'timeout': 3000,
157
- uspConsent: uspString,
158
- refererInfo: {
159
- referer: 'http://example.com/page.html',
160
- }
161
- };
162
- bidderRequest.bids = [adUnitBidRequest];
198
+ 'uspConsent': '1NYN',
199
+ 'bids': [baseBidRequest]
200
+ }
163
201
 
164
- const data = JSON.parse(spec.buildRequests([adUnitBidRequest], bidderRequest).data);
202
+ const data = JSON.parse(spec.buildRequests([baseBidRequest], bidderRequest).data)
165
203
 
166
- expect(data.regs.ext['us_privacy']).to.equal(uspString);
167
- });
204
+ expect(data.regs.ext['us_privacy']).to.equal(bidderRequest.uspConsent)
205
+ })
168
206
 
169
207
  it('should add schain if present', function() {
170
- const schainRequests = [{
171
- 'bidder': 'sovrn',
172
- 'params': {
173
- 'tagid': 403370
174
- },
175
- 'adUnitCode': 'adunit-code',
176
- 'sizes': [
177
- [300, 250],
178
- [300, 600]
179
- ],
180
- 'bidId': '30b31c1838de1e',
181
- 'bidderRequestId': '22edbae2733bf6',
182
- 'auctionId': '1d1a030790a475',
208
+ const schainRequest = {
209
+ ...baseBidRequest,
183
210
  'schain': {
184
211
  'ver': '1.0',
185
212
  'complete': 1,
@@ -192,100 +219,89 @@ describe('sovrnBidAdapter', function() {
192
219
  }
193
220
  ]
194
221
  }
195
- }].concat(adUnitBidRequest);
196
- const bidderRequest = {
197
- refererInfo: {
198
- referer: 'http://example.com/page.html',
199
- }
200
- };
201
- const data = JSON.parse(spec.buildRequests(schainRequests, bidderRequest).data);
222
+ }
223
+ const schainRequests = [schainRequest, baseBidRequest]
224
+
225
+ const data = JSON.parse(spec.buildRequests(schainRequests, baseBidderRequest).data)
202
226
 
203
227
  expect(data.source.ext.schain.nodes.length).to.equal(1)
204
- });
228
+ })
205
229
 
206
- it('should add ids to the bid request', function() {
207
- const criteoIdRequest = [{
208
- 'bidder': 'sovrn',
209
- 'params': {
210
- 'tagid': 403370
211
- },
212
- 'adUnitCode': 'adunit-code',
213
- 'sizes': [
214
- [300, 250],
215
- [300, 600]
216
- ],
217
- 'bidId': '30b31c1838de1e',
218
- 'bidderRequestId': '22edbae2733bf6',
219
- 'auctionId': '1d1a030790a475',
220
- 'userId': {
221
- 'criteoId': 'A_CRITEO_ID',
222
- 'tdid': 'SOMESORTOFID',
223
- }
224
- }].concat(adUnitBidRequest);
225
- const bidderRequest = {
226
- refererInfo: {
227
- referer: 'http://example.com/page.html',
230
+ it('should add eds to the bid request', function() {
231
+ const criteoIdRequest = {
232
+ ...baseBidRequest,
233
+ userId: {
234
+ criteoId: 'A_CRITEO_ID',
235
+ tdid: 'SOMESORTOFID',
228
236
  }
229
- };
230
-
231
- const data = JSON.parse(spec.buildRequests(criteoIdRequest, bidderRequest).data);
232
- expect(data.user.ext.eids[0].source).to.equal('criteo.com')
233
- expect(data.user.ext.eids[0].uids[0].id).to.equal('A_CRITEO_ID')
234
- expect(data.user.ext.eids[0].uids[0].atype).to.equal(1)
235
- expect(data.user.ext.eids[1].source).to.equal('adserver.org')
236
- expect(data.user.ext.eids[1].uids[0].id).to.equal('SOMESORTOFID')
237
- expect(data.user.ext.eids[1].uids[0].ext.rtiPartner).to.equal('TDID')
238
- expect(data.user.ext.eids[1].uids[0].atype).to.equal(1)
239
- expect(data.user.ext.tpid[0].source).to.equal('criteo.com')
240
- expect(data.user.ext.tpid[0].uid).to.equal('A_CRITEO_ID')
241
- expect(data.user.ext.prebid_criteoid).to.equal('A_CRITEO_ID')
242
- });
237
+ }
238
+ const criteoIdRequests = [criteoIdRequest, baseBidRequest]
239
+
240
+ const ext = JSON.parse(spec.buildRequests(criteoIdRequests, baseBidderRequest).data).user.ext
241
+ const firstEID = ext.eids[0]
242
+ const secondEID = ext.eids[1]
243
+
244
+ expect(firstEID.source).to.equal('criteo.com')
245
+ expect(firstEID.uids[0].id).to.equal('A_CRITEO_ID')
246
+ expect(firstEID.uids[0].atype).to.equal(1)
247
+ expect(secondEID.source).to.equal('adserver.org')
248
+ expect(secondEID.uids[0].id).to.equal('SOMESORTOFID')
249
+ expect(secondEID.uids[0].ext.rtiPartner).to.equal('TDID')
250
+ expect(secondEID.uids[0].atype).to.equal(1)
251
+ expect(ext.tpid[0].source).to.equal('criteo.com')
252
+ expect(ext.tpid[0].uid).to.equal('A_CRITEO_ID')
253
+ expect(ext.prebid_criteoid).to.equal('A_CRITEO_ID')
254
+ })
243
255
 
244
256
  it('should ignore empty segments', function() {
245
- const request = spec.buildRequests([adUnitBidRequest], bidderRequest)
257
+ const request = spec.buildRequests([baseBidRequest], baseBidderRequest)
246
258
  const payload = JSON.parse(request.data)
259
+
247
260
  expect(payload.imp[0].ext).to.be.undefined
248
261
  })
249
262
 
250
263
  it('should pass the segments param value as trimmed deal ids array', function() {
251
- const segmentsRequests = [{
252
- 'bidder': 'sovrn',
253
- 'params': {
254
- 'segments': ' test1,test2 '
255
- },
256
- 'adUnitCode': 'adunit-code',
257
- 'sizes': [
258
- [300, 250],
259
- [300, 600]
260
- ],
261
- 'bidId': '30b31c1838de1e',
262
- 'bidderRequestId': '22edbae2733bf6',
263
- 'auctionId': '1d1a030790a475'
264
- }]
265
- const request = spec.buildRequests(segmentsRequests, bidderRequest)
266
- const payload = JSON.parse(request.data)
267
- expect(payload.imp[0].ext.deals[0]).to.equal('test1')
268
- expect(payload.imp[0].ext.deals[1]).to.equal('test2')
264
+ const segmentsRequest = {
265
+ ...baseBidRequest,
266
+ params: {
267
+ segments: ' test1,test2 '
268
+ }
269
+ }
270
+ const request = spec.buildRequests([segmentsRequest], baseBidderRequest)
271
+ const deals = JSON.parse(request.data).imp[0].ext.deals
272
+
273
+ expect(deals[0]).to.equal('test1')
274
+ expect(deals[1]).to.equal('test2')
269
275
  })
270
276
  it('should use the floor provided from the floor module if present', function() {
271
- const floorBid = {...adUnitBidRequest, getFloor: () => ({currency: 'USD', floor: 1.10})}
272
- floorBid.params = {
273
- tagid: 1234,
274
- bidfloor: 2.00
277
+ const floorBid = {
278
+ ...baseBidRequest,
279
+ getFloor: () => ({currency: 'USD', floor: 1.10}),
280
+ params: {
281
+ tagid: 1234,
282
+ bidfloor: 2.00
283
+ }
275
284
  }
276
- const request = spec.buildRequests([floorBid], bidderRequest)
285
+
286
+ const request = spec.buildRequests([floorBid], baseBidderRequest)
277
287
  const payload = JSON.parse(request.data)
288
+
278
289
  expect(payload.imp[0].bidfloor).to.equal(1.10)
279
290
  })
280
291
  it('should use the floor from the param if there is no floor from the floor module', function() {
281
- const floorBid = {...adUnitBidRequest, getFloor: () => ({})}
292
+ const floorBid = {
293
+ ...baseBidRequest,
294
+ getFloor: () => ({})
295
+ }
282
296
  floorBid.params = {
283
297
  tagid: 1234,
284
298
  bidfloor: 2.00
285
299
  }
286
- const request = spec.buildRequests([floorBid], bidderRequest)
287
- const payload = JSON.parse(request.data)
288
- expect(payload.imp[0].bidfloor).to.equal(2.00)
300
+
301
+ const request = spec.buildRequests([floorBid], baseBidderRequest)
302
+ const impression = JSON.parse(request.data).imp[0]
303
+
304
+ expect(impression.bidfloor).to.equal(2.00)
289
305
  })
290
306
  describe('First Party Data', function () {
291
307
  let sandbox
@@ -307,54 +323,79 @@ describe('sovrnBidAdapter', function() {
307
323
  data: 'some user data'
308
324
  }
309
325
  }
310
- };
311
- return utils.deepAccess(cfg, key);
312
- });
313
- const request = spec.buildRequests([adUnitBidRequest], bidderRequest)
314
- const payload = JSON.parse(request.data)
315
- expect(payload.user.data).to.equal('some user data')
316
- expect(payload.site.keywords).to.equal('test keyword')
317
- expect(payload.site.page).to.equal('http://example.com/page.html')
318
- expect(payload.site.domain).to.equal('example.com')
326
+ }
327
+ return utils.deepAccess(cfg, key)
328
+ })
329
+
330
+ const request = spec.buildRequests([baseBidRequest], baseBidderRequest)
331
+ const { user, site } = JSON.parse(request.data)
332
+
333
+ expect(user.data).to.equal('some user data')
334
+ expect(site.keywords).to.equal('test keyword')
335
+ expect(site.page).to.equal('http://example.com/page.html')
336
+ expect(site.domain).to.equal('example.com')
319
337
  })
320
338
  it('should append impression first party data', function () {
321
- const fpdBid = {...adUnitBidRequest}
322
- fpdBid.ortb2Imp = {
323
- ext: {
324
- data: {
325
- pbadslot: 'homepage-top-rect',
326
- adUnitSpecificAttribute: '123'
339
+ const fpdBidRequest = {
340
+ ...baseBidRequest,
341
+ ortb2Imp: {
342
+ ext: {
343
+ data: {
344
+ pbadslot: 'homepage-top-rect',
345
+ adUnitSpecificAttribute: '123'
346
+ }
327
347
  }
328
348
  }
329
349
  }
330
- const request = spec.buildRequests([fpdBid], bidderRequest)
350
+
351
+ const request = spec.buildRequests([fpdBidRequest], baseBidderRequest)
331
352
  const payload = JSON.parse(request.data)
353
+
332
354
  expect(payload.imp[0].ext.data.pbadslot).to.equal('homepage-top-rect')
333
355
  expect(payload.imp[0].ext.data.adUnitSpecificAttribute).to.equal('123')
334
356
  })
335
357
  it('should not overwrite deals when impression fpd is present', function() {
336
- const fpdBid = {...adUnitBidRequest}
337
- fpdBid.params = {...adUnitBidRequest.params}
338
- fpdBid.params.segments = 'seg1, seg2'
339
- fpdBid.ortb2Imp = {
340
- ext: {
341
- data: {
342
- pbadslot: 'homepage-top-rect',
343
- adUnitSpecificAttribute: '123'
358
+ const fpdBid = {
359
+ ...baseBidRequest,
360
+ params: {
361
+ segments: 'seg1, seg2'
362
+ },
363
+ ortb2Imp: {
364
+ ext: {
365
+ data: {
366
+ pbadslot: 'homepage-top-rect',
367
+ adUnitSpecificAttribute: '123'
368
+ }
344
369
  }
345
370
  }
346
371
  }
347
- const request = spec.buildRequests([fpdBid], bidderRequest)
348
- const payload = JSON.parse(request.data)
349
- expect(payload.imp[0].ext.data.pbadslot).to.equal('homepage-top-rect')
350
- expect(payload.imp[0].ext.data.adUnitSpecificAttribute).to.equal('123')
351
- expect(payload.imp[0].ext.deals).to.deep.equal(['seg1', 'seg2'])
372
+
373
+ const request = spec.buildRequests([fpdBid], baseBidderRequest)
374
+ const impression = JSON.parse(request.data).imp[0]
375
+
376
+ expect(impression.ext.data.pbadslot).to.equal('homepage-top-rect')
377
+ expect(impression.ext.data.adUnitSpecificAttribute).to.equal('123')
378
+ expect(impression.ext.deals).to.deep.equal(['seg1', 'seg2'])
352
379
  })
353
380
  })
354
381
  });
355
382
 
356
383
  describe('interpretResponse', function () {
357
384
  let response;
385
+ const baseResponse = {
386
+ 'requestId': '263c448586f5a1',
387
+ 'cpm': 0.45882675,
388
+ 'width': 728,
389
+ 'height': 90,
390
+ 'creativeId': 'creativelycreatedcreativecreative',
391
+ 'dealId': null,
392
+ 'currency': 'USD',
393
+ 'netRevenue': true,
394
+ 'mediaType': 'banner',
395
+ 'ad': decodeURIComponent(`<!-- Creative --><img src="<!-- NURL -->">`),
396
+ 'ttl': 90,
397
+ 'meta': { advertiserDomains: [] }
398
+ }
358
399
  beforeEach(function () {
359
400
  response = {
360
401
  body: {
@@ -376,106 +417,175 @@ describe('sovrnBidAdapter', function() {
376
417
  });
377
418
 
378
419
  it('should get the correct bid response', function () {
379
- let expectedResponse = [{
380
- 'requestId': '263c448586f5a1',
381
- 'cpm': 0.45882675,
382
- 'width': 728,
383
- 'height': 90,
384
- 'creativeId': 'creativelycreatedcreativecreative',
385
- 'dealId': null,
386
- 'currency': 'USD',
387
- 'netRevenue': true,
388
- 'mediaType': 'banner',
420
+ const expectedResponse = {
421
+ ...baseResponse,
389
422
  'ad': decodeURIComponent(`<!-- Creative --><img src=<!-- NURL -->>`),
390
423
  'ttl': 60000,
391
- 'meta': { advertiserDomains: [] }
392
- }];
424
+ };
425
+
426
+ const result = spec.interpretResponse(response);
393
427
 
394
- let result = spec.interpretResponse(response);
395
- expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse[0]));
428
+ expect(result[0]).to.have.deep.keys(expectedResponse)
396
429
  });
397
430
 
398
431
  it('crid should default to the bid id if not on the response', function () {
399
432
  delete response.body.seatbid[0].bid[0].crid;
400
- let expectedResponse = [{
401
- 'requestId': '263c448586f5a1',
402
- 'cpm': 0.45882675,
403
- 'width': 728,
404
- 'height': 90,
433
+
434
+ const expectedResponse = {
435
+ ...baseResponse,
405
436
  'creativeId': response.body.seatbid[0].bid[0].id,
406
- 'dealId': null,
407
- 'currency': 'USD',
408
- 'netRevenue': true,
409
- 'mediaType': 'banner',
410
437
  'ad': decodeURIComponent(`<!-- Creative --><img src="<!-- NURL -->">`),
411
- 'ttl': 90,
412
- 'meta': { advertiserDomains: [] }
413
- }];
438
+ }
414
439
 
415
- let result = spec.interpretResponse(response);
416
- expect(result[0]).to.deep.equal(expectedResponse[0]);
440
+ const result = spec.interpretResponse(response);
441
+
442
+ expect(result[0]).to.deep.equal(expectedResponse);
417
443
  });
418
444
 
419
445
  it('should get correct bid response when dealId is passed', function () {
420
446
  response.body.seatbid[0].bid[0].dealid = 'baking';
421
-
422
- let expectedResponse = [{
423
- 'requestId': '263c448586f5a1',
424
- 'cpm': 0.45882675,
425
- 'width': 728,
426
- 'height': 90,
427
- 'creativeId': 'creativelycreatedcreativecreative',
447
+ const expectedResponse = {
448
+ ...baseResponse,
428
449
  'dealId': 'baking',
429
- 'currency': 'USD',
430
- 'netRevenue': true,
431
- 'mediaType': 'banner',
432
- 'ad': decodeURIComponent(`<!-- Creative --><img src="<!-- NURL -->">`),
433
- 'ttl': 90,
434
- 'meta': { advertiserDomains: [] }
435
- }];
450
+ }
451
+
452
+ const result = spec.interpretResponse(response)
436
453
 
437
- let result = spec.interpretResponse(response);
438
- expect(result[0]).to.deep.equal(expectedResponse[0]);
454
+ expect(result[0]).to.deep.equal(expectedResponse);
439
455
  });
440
456
 
441
457
  it('should get correct bid response when ttl is set', function () {
442
- response.body.seatbid[0].bid[0].ext = { 'ttl': 480 };
443
-
444
- let expectedResponse = [{
445
- 'requestId': '263c448586f5a1',
446
- 'cpm': 0.45882675,
447
- 'width': 728,
448
- 'height': 90,
449
- 'creativeId': 'creativelycreatedcreativecreative',
450
- 'dealId': null,
451
- 'currency': 'USD',
452
- 'netRevenue': true,
453
- 'mediaType': 'banner',
454
- 'ad': decodeURIComponent(`<!-- Creative --><img src="<!-- NURL -->">`),
458
+ response.body.seatbid[0].bid[0].ext = { 'ttl': 480 }
459
+
460
+ const expectedResponse = {
461
+ ...baseResponse,
455
462
  'ttl': 480,
456
- 'meta': { advertiserDomains: [] }
457
- }];
463
+ }
464
+
465
+ const result = spec.interpretResponse(response)
466
+
467
+ expect(result[0]).to.deep.equal(expectedResponse)
468
+ })
458
469
 
459
- let result = spec.interpretResponse(response);
460
- expect(result[0]).to.deep.equal(expectedResponse[0]);
470
+ it('handles empty bid response', function () {
471
+ const response = {
472
+ body: {
473
+ 'id': '37386aade21a71',
474
+ 'seatbid': []
475
+ }
476
+ };
477
+
478
+ const result = spec.interpretResponse(response)
479
+
480
+ expect(result.length).to.equal(0);
481
+ });
482
+ });
483
+
484
+ describe('interpretResponse video', function () {
485
+ let videoResponse;
486
+ const bidAdm = '<VAST version="4.2" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.iab.com/VAST">key%3Dvalue</VAST>';
487
+ const decodedBidAdm = decodeURIComponent(bidAdm);
488
+ const baseVideoResponse = {
489
+ 'requestId': '263c448586f5a1',
490
+ 'cpm': 0.45882675,
491
+ 'width': 640,
492
+ 'height': 480,
493
+ 'creativeId': 'creativelycreatedcreativecreative',
494
+ 'dealId': null,
495
+ 'currency': 'USD',
496
+ 'netRevenue': true,
497
+ 'mediaType': 'video',
498
+ 'ttl': 90,
499
+ 'meta': { advertiserDomains: [] },
500
+ 'vastXml': decodedBidAdm
501
+ }
502
+ beforeEach(function () {
503
+ videoResponse = {
504
+ body: {
505
+ 'id': '37386aade21a71',
506
+ 'seatbid': [{
507
+ 'bid': [{
508
+ 'id': 'a_403370_332fdb9b064040ddbec05891bd13ab28',
509
+ 'crid': 'creativelycreatedcreativecreative',
510
+ 'impid': '263c448586f5a1',
511
+ 'price': 0.45882675,
512
+ 'nurl': '',
513
+ 'adm': bidAdm,
514
+ 'h': 480,
515
+ 'w': 640
516
+ }]
517
+ }]
518
+ }
519
+ };
461
520
  });
462
521
 
522
+ it('should get the correct bid response', function () {
523
+ const expectedResponse = {
524
+ ...baseVideoResponse,
525
+ 'ttl': 60000,
526
+ };
527
+
528
+ const result = spec.interpretResponse(videoResponse);
529
+
530
+ expect(result[0]).to.have.deep.keys(expectedResponse)
531
+ });
532
+
533
+ it('crid should default to the bid id if not on the response', function () {
534
+ delete videoResponse.body.seatbid[0].bid[0].crid;
535
+
536
+ const expectedResponse = {
537
+ ...baseVideoResponse,
538
+ 'creativeId': videoResponse.body.seatbid[0].bid[0].id,
539
+ }
540
+
541
+ const result = spec.interpretResponse(videoResponse);
542
+
543
+ expect(result[0]).to.deep.equal(expectedResponse);
544
+ });
545
+
546
+ it('should get correct bid response when dealId is passed', function () {
547
+ videoResponse.body.seatbid[0].bid[0].dealid = 'baking';
548
+ const expectedResponse = {
549
+ ...baseVideoResponse,
550
+ 'dealId': 'baking',
551
+ }
552
+
553
+ const result = spec.interpretResponse(videoResponse)
554
+
555
+ expect(result[0]).to.deep.equal(expectedResponse);
556
+ });
557
+
558
+ it('should get correct bid response when ttl is set', function () {
559
+ videoResponse.body.seatbid[0].bid[0].ext = { 'ttl': 480 }
560
+
561
+ const expectedResponse = {
562
+ ...baseVideoResponse,
563
+ 'ttl': 480,
564
+ }
565
+
566
+ const result = spec.interpretResponse(videoResponse)
567
+
568
+ expect(result[0]).to.deep.equal(expectedResponse)
569
+ })
570
+
463
571
  it('handles empty bid response', function () {
464
- let response = {
572
+ const response = {
465
573
  body: {
466
574
  'id': '37386aade21a71',
467
575
  'seatbid': []
468
576
  }
469
577
  };
470
- let result = spec.interpretResponse(response);
578
+
579
+ const result = spec.interpretResponse(response)
580
+
471
581
  expect(result.length).to.equal(0);
472
582
  });
473
583
  });
474
584
 
475
585
  describe('getUserSyncs ', function() {
476
- let syncOptions = { iframeEnabled: true, pixelEnabled: false };
477
- let iframeDisabledSyncOptions = { iframeEnabled: false, pixelEnabled: false };
478
- let serverResponse = [
586
+ const syncOptions = { iframeEnabled: true, pixelEnabled: false };
587
+ const iframeDisabledSyncOptions = { iframeEnabled: false, pixelEnabled: false };
588
+ const serverResponse = [
479
589
  {
480
590
  'body': {
481
591
  'id': '546956d68c757f',
@@ -524,14 +634,14 @@ describe('sovrnBidAdapter', function() {
524
634
  ];
525
635
 
526
636
  it('should return if iid present on server response & iframe syncs enabled', function() {
527
- const expectedReturnStatement = [
528
- {
529
- 'type': 'iframe',
530
- 'url': 'https://ap.lijit.com/beacon?informer=13487408',
531
- }
532
- ];
637
+ const expectedReturnStatement = {
638
+ 'type': 'iframe',
639
+ 'url': 'https://ap.lijit.com/beacon?informer=13487408',
640
+ }
641
+
533
642
  const returnStatement = spec.getUserSyncs(syncOptions, serverResponse);
534
- expect(returnStatement[0]).to.deep.equal(expectedReturnStatement[0]);
643
+
644
+ expect(returnStatement[0]).to.deep.equal(expectedReturnStatement);
535
645
  });
536
646
 
537
647
  it('should include gdpr consent string if present', function() {
@@ -539,26 +649,26 @@ describe('sovrnBidAdapter', function() {
539
649
  gdprApplies: 1,
540
650
  consentString: 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A=='
541
651
  }
542
- const expectedReturnStatement = [
543
- {
544
- 'type': 'iframe',
545
- 'url': `https://ap.lijit.com/beacon?gdpr_consent=${gdprConsent.consentString}&informer=13487408`,
546
- }
547
- ];
652
+ const expectedReturnStatement = {
653
+ 'type': 'iframe',
654
+ 'url': `https://ap.lijit.com/beacon?gdpr_consent=${gdprConsent.consentString}&informer=13487408`,
655
+ }
656
+
548
657
  const returnStatement = spec.getUserSyncs(syncOptions, serverResponse, gdprConsent, '');
549
- expect(returnStatement[0]).to.deep.equal(expectedReturnStatement[0]);
658
+
659
+ expect(returnStatement[0]).to.deep.equal(expectedReturnStatement);
550
660
  });
551
661
 
552
662
  it('should include us privacy string if present', function() {
553
663
  const uspString = '1NYN';
554
- const expectedReturnStatement = [
555
- {
556
- 'type': 'iframe',
557
- 'url': `https://ap.lijit.com/beacon?us_privacy=${uspString}&informer=13487408`,
558
- }
559
- ];
664
+ const expectedReturnStatement = {
665
+ 'type': 'iframe',
666
+ 'url': `https://ap.lijit.com/beacon?us_privacy=${uspString}&informer=13487408`,
667
+ }
668
+
560
669
  const returnStatement = spec.getUserSyncs(syncOptions, serverResponse, null, uspString);
561
- expect(returnStatement[0]).to.deep.equal(expectedReturnStatement[0]);
670
+
671
+ expect(returnStatement[0]).to.deep.equal(expectedReturnStatement);
562
672
  });
563
673
 
564
674
  it('should include all privacy strings if present', function() {
@@ -567,57 +677,35 @@ describe('sovrnBidAdapter', function() {
567
677
  consentString: 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A=='
568
678
  }
569
679
  const uspString = '1NYN';
570
- const expectedReturnStatement = [
571
- {
572
- 'type': 'iframe',
573
- 'url': `https://ap.lijit.com/beacon?gdpr_consent=${gdprConsent.consentString}&us_privacy=${uspString}&informer=13487408`,
574
- }
575
- ];
576
- const returnStatement = spec.getUserSyncs(syncOptions, serverResponse, gdprConsent, uspString);
577
- expect(returnStatement[0]).to.deep.equal(expectedReturnStatement[0]);
680
+ const expectedReturnStatement = {
681
+ 'type': 'iframe',
682
+ 'url': `https://ap.lijit.com/beacon?gdpr_consent=${gdprConsent.consentString}&us_privacy=${uspString}&informer=13487408`,
683
+ }
684
+
685
+ const returnStatement = spec.getUserSyncs(syncOptions, serverResponse, gdprConsent, uspString)
686
+
687
+ expect(returnStatement[0]).to.deep.equal(expectedReturnStatement)
578
688
  });
579
689
 
580
690
  it('should not return if iid missing on server response', function() {
581
691
  const returnStatement = spec.getUserSyncs(syncOptions, []);
692
+
582
693
  expect(returnStatement).to.be.empty;
583
694
  });
584
695
 
585
696
  it('should not return if iframe syncs disabled', function() {
586
697
  const returnStatement = spec.getUserSyncs(iframeDisabledSyncOptions, serverResponse);
698
+
587
699
  expect(returnStatement).to.be.empty;
588
700
  });
589
701
 
590
702
  it('should include pixel syncs', function() {
591
- let pixelEnabledOptions = { iframeEnabled: false, pixelEnabled: true };
592
- const resp2 = {
703
+ const pixelEnabledOptions = { iframeEnabled: false, pixelEnabled: true }
704
+
705
+ const otherResponce = {
706
+ ...serverResponse,
593
707
  'body': {
594
- 'id': '546956d68c757f-2',
595
- 'seatbid': [
596
- {
597
- 'bid': [
598
- {
599
- 'id': 'a_448326_16c2ada014224bee815a90d2248322f5-2',
600
- 'impid': '2a3826aae345f4',
601
- 'price': 1.0099999904632568,
602
- 'nurl': 'http://localhost/rtb/impression?bannerid=220958&campaignid=3890&rtb_tid=15588614-75d2-40ab-b27e-13d2127b3c2e&rpid=1295&seatid=seat1&zoneid=448326&cb=26900712&tid=a_448326_16c2ada014224bee815a90d2248322f5',
603
- 'adm': 'yo a creative',
604
- 'crid': 'cridprebidrtb',
605
- 'w': 160,
606
- 'h': 600
607
- },
608
- {
609
- 'id': 'a_430392_beac4c1515da4576acf6cb9c5340b40c-2',
610
- 'impid': '3cf96fd26ed4c5',
611
- 'price': 1.0099999904632568,
612
- 'nurl': 'http://localhost/rtb/impression?bannerid=220957&campaignid=3890&rtb_tid=5bc0e68b-3492-448d-a6f9-26fa3fd0b646&rpid=1295&seatid=seat1&zoneid=430392&cb=62735099&tid=a_430392_beac4c1515da4576acf6cb9c5340b40c',
613
- 'adm': 'yo a creative',
614
- 'crid': 'cridprebidrtb',
615
- 'w': 300,
616
- 'h': 250
617
- },
618
- ]
619
- }
620
- ],
708
+ ...serverResponse.body,
621
709
  'ext': {
622
710
  'iid': 13487408,
623
711
  sync: {
@@ -631,10 +719,11 @@ describe('sovrnBidAdapter', function() {
631
719
  ]
632
720
  }
633
721
  }
634
- },
635
- 'headers': {}
722
+ }
636
723
  }
637
- const returnStatement = spec.getUserSyncs(pixelEnabledOptions, [...serverResponse, resp2]);
724
+
725
+ const returnStatement = spec.getUserSyncs(pixelEnabledOptions, [...serverResponse, otherResponce])
726
+
638
727
  expect(returnStatement.length).to.equal(4);
639
728
  expect(returnStatement).to.deep.include.members([
640
729
  { type: 'image', url: 'http://idprovider1.com' },
@@ -642,34 +731,25 @@ describe('sovrnBidAdapter', function() {
642
731
  { type: 'image', url: 'http://idprovider3.com' },
643
732
  { type: 'image', url: 'http://idprovider4.com' }
644
733
  ]);
645
- });
646
- });
734
+ })
735
+ })
647
736
 
648
737
  describe('prebid 3 upgrade', function() {
649
- const bidRequests = [{
650
- 'bidder': 'sovrn',
738
+ const bidRequest = {
739
+ ...baseBidRequest,
651
740
  'params': {
652
741
  'tagid': '403370'
653
742
  },
654
- 'adUnitCode': 'adunit-code',
655
- mediaTypes: {
656
- banner: {
657
- sizes: [
743
+ 'mediaTypes': {
744
+ 'banner': {
745
+ 'sizes': [
658
746
  [300, 250],
659
747
  [300, 600]
660
748
  ]
661
749
  }
662
750
  },
663
- 'bidId': '30b31c1838de1e',
664
- 'bidderRequestId': '22edbae2733bf6',
665
- 'auctionId': '1d1a030790a475'
666
- }];
667
- const bidderRequest = {
668
- refererInfo: {
669
- referer: 'http://example.com/page.html',
670
- }
671
751
  };
672
- const request = spec.buildRequests(bidRequests, bidderRequest);
752
+ const request = spec.buildRequests([bidRequest], baseBidderRequest);
673
753
  const payload = JSON.parse(request.data);
674
754
 
675
755
  it('gets sizes from mediaTypes.banner', function() {