@@ -165,16 +165,20 @@ describe('bridgewellBidAdapter', function () {
165165 expect ( payload ) . to . be . an ( 'object' ) ;
166166 expect ( payload . adUnits ) . to . be . an ( 'array' ) ;
167167 expect ( payload . url ) . to . exist . and . to . equal ( 'https://www.bridgewell.com/' ) ;
168+ expect ( payload . userIds ) . to . deep . equal ( userId ) ;
169+ expect ( payload . userIdAsEids ) . to . deep . equal ( userIdAsEids ) ;
170+ expect ( payload . auctionId ) . to . equal ( '1d1a030790a475' ) ;
171+ expect ( payload . bidderRequestId ) . to . equal ( '22edbae2733bf6' ) ;
168172 for ( let i = 0 , max_i = payload . adUnits . length ; i < max_i ; i ++ ) {
169173 const u = payload . adUnits [ i ] ;
170174 expect ( u ) . to . have . property ( 'ChannelID' ) . that . is . a ( 'string' ) ;
171175 expect ( u ) . to . not . have . property ( 'cid' ) ;
172176 expect ( u ) . to . have . property ( 'adUnitCode' ) . and . to . equal ( 'adunit-code-2' ) ;
173177 expect ( u ) . to . have . property ( 'requestId' ) . and . to . equal ( '3150ccb55da321' ) ;
174- expect ( u ) . to . have . property ( 'userIds ' ) ;
175- expect ( u . userIds ) . to . deep . equal ( userId ) ;
176- expect ( u ) . to . have . property ( 'userIdAsEids ' ) ;
177- expect ( u . userIdAsEids ) . to . deep . equal ( userIdAsEids ) ;
178+ expect ( u ) . to . have . property ( 'transactionId ' ) ;
179+ expect ( u ) . to . have . property ( 'sizes' ) ;
180+ expect ( u ) . to . have . property ( 'mediaTypes ' ) ;
181+ expect ( u ) . to . have . property ( 'ortb2Imp' ) ;
178182 }
179183 } ) ;
180184
@@ -213,16 +217,20 @@ describe('bridgewellBidAdapter', function () {
213217 expect ( payload ) . to . be . an ( 'object' ) ;
214218 expect ( payload . adUnits ) . to . be . an ( 'array' ) ;
215219 expect ( payload . url ) . to . exist . and . to . equal ( 'https://www.bridgewell.com/' ) ;
220+ expect ( payload . userIds ) . to . deep . equal ( userId ) ;
221+ expect ( payload . userIdAsEids ) . to . deep . equal ( userIdAsEids ) ;
222+ expect ( payload . auctionId ) . to . equal ( '1d1a030790a475' ) ;
223+ expect ( payload . bidderRequestId ) . to . equal ( '22edbae2733bf6' ) ;
216224 for ( let i = 0 , max_i = payload . adUnits . length ; i < max_i ; i ++ ) {
217225 const u = payload . adUnits [ i ] ;
218226 expect ( u ) . to . have . property ( 'cid' ) . that . is . a ( 'number' ) ;
219227 expect ( u ) . to . not . have . property ( 'ChannelID' ) ;
220228 expect ( u ) . to . have . property ( 'adUnitCode' ) . and . to . equal ( 'adunit-code-2' ) ;
221229 expect ( u ) . to . have . property ( 'requestId' ) . and . to . equal ( '3150ccb55da321' ) ;
222- expect ( u ) . to . have . property ( 'userIds ' ) ;
223- expect ( u . userIds ) . to . deep . equal ( userId ) ;
224- expect ( u ) . to . have . property ( 'userIdAsEids ' ) ;
225- expect ( u . userIdAsEids ) . to . deep . equal ( userIdAsEids ) ;
230+ expect ( u ) . to . have . property ( 'transactionId ' ) ;
231+ expect ( u ) . to . have . property ( 'sizes' ) ;
232+ expect ( u ) . to . have . property ( 'mediaTypes ' ) ;
233+ expect ( u ) . to . have . property ( 'ortb2Imp' ) ;
226234 }
227235 } ) ;
228236
@@ -240,6 +248,178 @@ describe('bridgewellBidAdapter', function () {
240248 const validBidRequests = request . validBidRequests ;
241249 expect ( validBidRequests ) . to . deep . equal ( bidRequests ) ;
242250 } ) ;
251+
252+ it ( 'should include ortb2Imp fields in adUnit' , function ( ) {
253+ const bidderRequest = {
254+ refererInfo : {
255+ page : 'https://www.bridgewell.com/' ,
256+ legacy : {
257+ referer : 'https://www.bridgewell.com/' ,
258+ }
259+ }
260+ }
261+ const bidRequestsWithOrtb2 = [
262+ {
263+ 'bidder' : 'bridgewell' ,
264+ 'params' : {
265+ 'cid' : 1234 ,
266+ } ,
267+ 'adUnitCode' : 'adunit-code-1' ,
268+ 'transactionId' : 'trans-123' ,
269+ 'adUnitId' : 'adunit-123' ,
270+ 'sizes' : [ [ 300 , 250 ] ] ,
271+ 'mediaTypes' : {
272+ 'banner' : {
273+ 'sizes' : [ [ 300 , 250 ] ]
274+ }
275+ } ,
276+ 'bidId' : 'bid-123' ,
277+ 'ortb2Imp' : {
278+ 'ext' : {
279+ 'data' : {
280+ 'adserver' : {
281+ 'name' : 'gam' ,
282+ 'adslot' : '/1234/test'
283+ } ,
284+ 'pbadslot' : '/1234/test-pbadslot'
285+ } ,
286+ 'gpid' : 'test-gpid' ,
287+ 'prebid' : {
288+ 'passthrough' : {
289+ 'bucket' : 'test-bucket' ,
290+ 'client' : 'test-client' ,
291+ 'gamAdCode' : 'test-gam' ,
292+ 'undefinedField' : undefined
293+ }
294+ }
295+ } ,
296+ 'banner' : {
297+ 'pos' : 1
298+ }
299+ } ,
300+ 'userId' : userId ,
301+ 'userIdAsEids' : userIdAsEids ,
302+ }
303+ ] ;
304+
305+ const request = spec . buildRequests ( bidRequestsWithOrtb2 , bidderRequest ) ;
306+ const adUnit = request . data . adUnits [ 0 ] ;
307+
308+ expect ( adUnit . transactionId ) . to . equal ( 'trans-123' ) ;
309+ expect ( adUnit . adUnitId ) . to . equal ( 'adunit-123' ) ;
310+ expect ( adUnit . sizes ) . to . deep . equal ( [ [ 300 , 250 ] ] ) ;
311+ expect ( adUnit . ortb2Imp . ext . data . adserver . name ) . to . equal ( 'gam' ) ;
312+ expect ( adUnit . ortb2Imp . ext . data . adserver . adslot ) . to . equal ( '/1234/test' ) ;
313+ expect ( adUnit . ortb2Imp . ext . data . pbadslot ) . to . equal ( '/1234/test-pbadslot' ) ;
314+ expect ( adUnit . ortb2Imp . ext . gpid ) . to . equal ( 'test-gpid' ) ;
315+ expect ( adUnit . ortb2Imp . banner . pos ) . to . equal ( 1 ) ;
316+ expect ( adUnit . ortb2Imp . ext . prebid . passthrough ) . to . deep . equal ( {
317+ bucket : 'test-bucket' ,
318+ client : 'test-client' ,
319+ gamAdCode : 'test-gam'
320+ } ) ;
321+ expect ( adUnit . ortb2Imp . ext . prebid . passthrough ) . to . not . have . property ( 'undefinedField' ) ;
322+ } ) ;
323+
324+ it ( 'should include floor information when getFloor is available' , function ( ) {
325+ const bidderRequest = {
326+ refererInfo : {
327+ page : 'https://www.bridgewell.com/' ,
328+ legacy : {
329+ referer : 'https://www.bridgewell.com/' ,
330+ }
331+ }
332+ }
333+ const bidRequestsWithFloor = [
334+ {
335+ 'bidder' : 'bridgewell' ,
336+ 'params' : {
337+ 'cid' : 1234 ,
338+ } ,
339+ 'adUnitCode' : 'adunit-code-1' ,
340+ 'mediaTypes' : {
341+ 'banner' : {
342+ 'sizes' : [ [ 300 , 250 ] ]
343+ }
344+ } ,
345+ 'bidId' : 'bid-123' ,
346+ 'getFloor' : function ( ) {
347+ return {
348+ floor : 1.5 ,
349+ currency : 'USD'
350+ } ;
351+ } ,
352+ 'userId' : userId ,
353+ 'userIdAsEids' : userIdAsEids ,
354+ }
355+ ] ;
356+
357+ const request = spec . buildRequests ( bidRequestsWithFloor , bidderRequest ) ;
358+ const adUnit = request . data . adUnits [ 0 ] ;
359+
360+ expect ( adUnit . floor ) . to . equal ( 1.5 ) ;
361+ expect ( adUnit . currency ) . to . equal ( 'USD' ) ;
362+ } ) ;
363+
364+ it ( 'should include additional bid request fields in payload' , function ( ) {
365+ const bidderRequest = {
366+ refererInfo : {
367+ page : 'https://www.bridgewell.com/' ,
368+ ref : 'https://www.referrer.com/' ,
369+ legacy : {
370+ referer : 'https://www.bridgewell.com/' ,
371+ }
372+ } ,
373+ ortb2 : {
374+ site : {
375+ name : 'test-site'
376+ }
377+ }
378+ }
379+ const bidRequestsWithMetrics = [
380+ {
381+ 'bidder' : 'bridgewell' ,
382+ 'params' : {
383+ 'cid' : 1234 ,
384+ } ,
385+ 'adUnitCode' : 'adunit-code-1' ,
386+ 'mediaTypes' : {
387+ 'banner' : {
388+ 'sizes' : [ [ 300 , 250 ] ]
389+ }
390+ } ,
391+ 'bidId' : 'bid-123' ,
392+ 'bidderRequestId' : 'bidder-req-123' ,
393+ 'auctionId' : 'auction-123' ,
394+ 'src' : 's2s' ,
395+ 'auctionsCount' : 5 ,
396+ 'bidRequestsCount' : 10 ,
397+ 'bidderRequestsCount' : 3 ,
398+ 'bidderWinsCount' : 2 ,
399+ 'deferBilling' : true ,
400+ 'metrics' : {
401+ 'test' : 'metric'
402+ } ,
403+ 'userId' : userId ,
404+ 'userIdAsEids' : userIdAsEids ,
405+ }
406+ ] ;
407+
408+ const request = spec . buildRequests ( bidRequestsWithMetrics , bidderRequest ) ;
409+ const payload = request . data ;
410+
411+ expect ( payload . auctionId ) . to . equal ( 'auction-123' ) ;
412+ expect ( payload . bidderRequestId ) . to . equal ( 'bidder-req-123' ) ;
413+ expect ( payload . src ) . to . equal ( 's2s' ) ;
414+ expect ( payload . auctionsCount ) . to . equal ( 5 ) ;
415+ expect ( payload . bidRequestsCount ) . to . equal ( 10 ) ;
416+ expect ( payload . bidderRequestsCount ) . to . equal ( 3 ) ;
417+ expect ( payload . bidderWinsCount ) . to . equal ( 2 ) ;
418+ expect ( payload . deferBilling ) . to . equal ( true ) ;
419+ expect ( payload . metrics ) . to . deep . equal ( { test : 'metric' } ) ;
420+ expect ( payload . referrer ) . to . equal ( 'https://www.referrer.com/' ) ;
421+ expect ( payload . ortb2 ) . to . deep . equal ( { site : { name : 'test-site' } } ) ;
422+ } ) ;
243423 } ) ;
244424
245425 describe ( 'interpretResponse' , function ( ) {
0 commit comments