@@ -100,6 +100,38 @@ describe('Outbrain Adapter', function () {
100
100
}
101
101
expect ( spec . isBidRequestValid ( bid ) ) . to . equal ( false )
102
102
} )
103
+ it ( 'should fail if tag id is not string' , function ( ) {
104
+ const bid = {
105
+ bidder : 'outbrain' ,
106
+ params : {
107
+ tagid : 123
108
+ } ,
109
+ ...nativeBidRequestParams ,
110
+ }
111
+ expect ( spec . isBidRequestValid ( bid ) ) . to . equal ( false )
112
+ } )
113
+ it ( 'should fail if badv does not include strings' , function ( ) {
114
+ const bid = {
115
+ bidder : 'outbrain' ,
116
+ params : {
117
+ tagid : 123 ,
118
+ badv : [ 'a' , 2 , 'c' ]
119
+ } ,
120
+ ...nativeBidRequestParams ,
121
+ }
122
+ expect ( spec . isBidRequestValid ( bid ) ) . to . equal ( false )
123
+ } )
124
+ it ( 'should fail if bcat does not include strings' , function ( ) {
125
+ const bid = {
126
+ bidder : 'outbrain' ,
127
+ params : {
128
+ tagid : 123 ,
129
+ bcat : [ 'a' , 2 , 'c' ]
130
+ } ,
131
+ ...nativeBidRequestParams ,
132
+ }
133
+ expect ( spec . isBidRequestValid ( bid ) ) . to . equal ( false )
134
+ } )
103
135
it ( 'should succeed with outbrain config' , function ( ) {
104
136
const bid = {
105
137
bidder : 'outbrain' ,
@@ -362,6 +394,63 @@ describe('Outbrain Adapter', function () {
362
394
{ source : 'liveramp.com' , uids : [ { id : 'id-value' , atype : 3 } ] }
363
395
] ) ;
364
396
} ) ;
397
+
398
+ it ( 'should pass bidfloor' , function ( ) {
399
+ const bidRequest = {
400
+ ...commonBidRequest ,
401
+ ...nativeBidRequestParams ,
402
+ }
403
+ bidRequest . getFloor = function ( ) {
404
+ return {
405
+ currency : 'USD' ,
406
+ floor : 1.23 ,
407
+ }
408
+ }
409
+
410
+ const res = spec . buildRequests ( [ bidRequest ] , commonBidderRequest )
411
+ const resData = JSON . parse ( res . data )
412
+ expect ( resData . imp [ 0 ] . bidfloor ) . to . equal ( 1.23 )
413
+ } ) ;
414
+
415
+ it ( 'should transform string sizes to numbers' , function ( ) {
416
+ let bidRequest = {
417
+ bidId : 'bidId' ,
418
+ params : { } ,
419
+ ...commonBidRequest ,
420
+ ...nativeBidRequestParams ,
421
+ } ;
422
+ bidRequest . nativeParams . image . sizes = [ '120' , '100' ]
423
+
424
+ const expectedNativeAssets = {
425
+ assets : [
426
+ {
427
+ required : 1 ,
428
+ id : 3 ,
429
+ img : {
430
+ type : 3 ,
431
+ w : 120 ,
432
+ h : 100
433
+ }
434
+ } ,
435
+ {
436
+ required : 1 ,
437
+ id : 0 ,
438
+ title : { }
439
+ } ,
440
+ {
441
+ required : 0 ,
442
+ id : 5 ,
443
+ data : {
444
+ type : 1
445
+ }
446
+ }
447
+ ]
448
+ }
449
+
450
+ let res = spec . buildRequests ( [ bidRequest ] , commonBidderRequest ) ;
451
+ const resData = JSON . parse ( res . data )
452
+ expect ( resData . imp [ 0 ] . native . request ) . to . equal ( JSON . stringify ( expectedNativeAssets ) ) ;
453
+ } ) ;
365
454
} )
366
455
367
456
describe ( 'interpretResponse' , function ( ) {
@@ -382,7 +471,7 @@ describe('Outbrain Adapter', function () {
382
471
impid : '1' ,
383
472
price : 1.1 ,
384
473
nurl : 'http://example.com/win/${AUCTION_PRICE}' ,
385
- adm : '{"ver":"1.2","assets":[{"id":3,"required":1,"img":{"url":"http://example.com/img/url","w":120,"h":100}},{"id":0,"required":1,"title":{"text":"Test title"}},{"id":5,"data":{"value":"Test sponsor"}}],"link":{"url":"http://example.com/click/url"},"eventtrackers":[{"event":1,"method":1,"url":"http://example.com/impression"}]}' ,
474
+ adm : '{"ver":"1.2","assets":[{"id":3,"required":1,"img":{"url":"http://example.com/img/url","w":120,"h":100}},{"id":0,"required":1,"title":{"text":"Test title"}},{"id":5,"data":{"value":"Test sponsor"}}],"privacy":"http://example.com/privacy"," link":{"url":"http://example.com/click/url"},"eventtrackers":[{"event":1,"method":1,"url":"http://example.com/impression"}]}' ,
386
475
adomain : [
387
476
'example.com'
388
477
] ,
@@ -435,7 +524,8 @@ describe('Outbrain Adapter', function () {
435
524
sponsoredBy : 'Test sponsor' ,
436
525
impressionTrackers : [
437
526
'http://example.com/impression' ,
438
- ]
527
+ ] ,
528
+ privacyLink : 'http://example.com/privacy'
439
529
}
440
530
}
441
531
]
0 commit comments