@@ -242,8 +242,7 @@ describe('SonobiBidAdapter', function () {
242
242
} ,
243
243
'adUnitCode' : 'adunit-code-2' ,
244
244
'sizes' : [ [ 120 , 600 ] , [ 300 , 600 ] , [ 160 , 600 ] ] ,
245
- 'bidId' : '30b31c1838de1e' ,
246
- 'mediaType' : 'video'
245
+ 'bidId' : '30b31c1838de1e'
247
246
} ,
248
247
{
249
248
'bidder' : 'sonobi' ,
@@ -274,6 +273,14 @@ describe('SonobiBidAdapter', function () {
274
273
'sbi_aid' : '30292e432662bd5f86d90774b944b038' ,
275
274
'sbi_mouse' : 1.25 ,
276
275
'sbi_dozer' : 'dozerkey' ,
276
+ 'sbi_ct' : 'video'
277
+ } ,
278
+ '/7780971/sparks_prebid_LB_OUTSTREAM|30b31c1838de1g' : {
279
+ 'sbi_size' : '300x600' ,
280
+ 'sbi_apoc' : 'remnant' ,
281
+ 'sbi_crid' : '1234abcd' ,
282
+ 'sbi_aid' : '30292e432662bd5f86d90774b944b038' ,
283
+ 'sbi_mouse' : 1.07 ,
277
284
} ,
278
285
'/7780971/sparks_prebid_LB|30b31c1838de1g' : { } ,
279
286
} ,
@@ -313,22 +320,42 @@ describe('SonobiBidAdapter', function () {
313
320
'currency' : 'USD' ,
314
321
'dealId' : 'dozerkey' ,
315
322
'aid' : '30292e432662bd5f86d90774b944b038'
316
- }
323
+ } ,
324
+ {
325
+ 'requestId' : '30b31c1838de1g' ,
326
+ 'cpm' : 1.07 ,
327
+ 'width' : 300 ,
328
+ 'height' : 600 ,
329
+ 'ad' : `<script type="text/javascript" src="https://mco-1-apex.go.sonobi.com/sbi.js?aid=30292e432662bd5f86d90774b944b038&as=null&ref=http%3A%2F%2Flocalhost%2F"></script>` ,
330
+ 'ttl' : 500 ,
331
+ 'creativeId' : '1234abcd' ,
332
+ 'netRevenue' : true ,
333
+ 'currency' : 'USD' ,
334
+ 'aid' : '30292e432662bd5f86d90774b944b038'
335
+ } ,
317
336
] ;
318
337
319
338
it ( 'should map bidResponse to prebidResponse' , function ( ) {
320
339
const response = spec . interpretResponse ( bidResponse , bidRequests ) ;
321
340
response . forEach ( ( resp , i ) => {
322
341
expect ( resp . requestId ) . to . equal ( prebidResponse [ i ] . requestId ) ;
323
342
expect ( resp . cpm ) . to . equal ( prebidResponse [ i ] . cpm ) ;
324
- expect ( resp . width ) . to . equal ( prebidResponse [ i ] . width ) ;
325
- expect ( resp . height ) . to . equal ( prebidResponse [ i ] . height ) ;
343
+
326
344
expect ( resp . ttl ) . to . equal ( prebidResponse [ i ] . ttl ) ;
327
345
expect ( resp . creativeId ) . to . equal ( prebidResponse [ i ] . creativeId ) ;
328
346
expect ( resp . netRevenue ) . to . equal ( prebidResponse [ i ] . netRevenue ) ;
329
347
expect ( resp . currency ) . to . equal ( prebidResponse [ i ] . currency ) ;
330
348
expect ( resp . aid ) . to . equal ( prebidResponse [ i ] . aid ) ;
331
- expect ( resp . ad . indexOf ( 'localhost' ) ) . to . be . greaterThan ( 0 ) ;
349
+ if ( resp . mediaType === 'video' ) {
350
+ expect ( resp . vastUrl . indexOf ( 'vast.xml' ) ) . to . be . greaterThan ( 0 ) ;
351
+ expect ( resp . ad ) . to . be . undefined ;
352
+ expect ( resp . width ) . to . be . undefined ;
353
+ expect ( resp . height ) . to . be . undefined ;
354
+ } else {
355
+ expect ( resp . ad . indexOf ( 'localhost' ) ) . to . be . greaterThan ( 0 ) ;
356
+ expect ( resp . width ) . to . equal ( prebidResponse [ i ] . width ) ;
357
+ expect ( resp . height ) . to . equal ( prebidResponse [ i ] . height ) ;
358
+ }
332
359
} ) ;
333
360
} ) ;
334
361
} ) ;
0 commit comments