@@ -127,6 +127,29 @@ describe('Zeta Ssp Bid Adapter', function () {
127
127
timeout : 500
128
128
} ] ;
129
129
130
+ const bannerWithFewSizesRequest = [ {
131
+ bidId : 12345 ,
132
+ auctionId : 67890 ,
133
+ mediaTypes : {
134
+ banner : {
135
+ sizes : [ [ 300 , 250 ] , [ 200 , 240 ] , [ 100 , 150 ] ] ,
136
+ }
137
+ } ,
138
+ refererInfo : {
139
+ page : 'http://www.zetaglobal.com/page?param=value' ,
140
+ domain : 'www.zetaglobal.com' ,
141
+ } ,
142
+ gdprConsent : {
143
+ gdprApplies : 1 ,
144
+ consentString : 'consentString'
145
+ } ,
146
+ schain : schain ,
147
+ uspConsent : 'someCCPAString' ,
148
+ params : params ,
149
+ userIdAsEids : eids ,
150
+ timeout : 500
151
+ } ] ;
152
+
130
153
const videoRequest = [ {
131
154
bidId : 112233 ,
132
155
auctionId : 667788 ,
@@ -408,4 +431,38 @@ describe('Zeta Ssp Bid Adapter', function () {
408
431
409
432
expect ( payload . imp [ 0 ] . tagid ) . to . eql ( params . tagid ) ;
410
433
} ) ;
434
+
435
+ it ( 'Test if only one size' , function ( ) {
436
+ const request = spec . buildRequests ( bannerRequest , bannerRequest [ 0 ] ) ;
437
+ const payload = JSON . parse ( request . data ) ;
438
+
439
+ // banner
440
+ expect ( payload . imp [ 0 ] . banner . w ) . to . eql ( 300 ) ;
441
+ expect ( payload . imp [ 0 ] . banner . h ) . to . eql ( 250 ) ;
442
+
443
+ expect ( payload . imp [ 0 ] . banner . format ) . to . be . undefined ;
444
+ } ) ;
445
+
446
+ it ( 'Test few sizes provided in format' , function ( ) {
447
+ const request = spec . buildRequests ( bannerWithFewSizesRequest , bannerWithFewSizesRequest [ 0 ] ) ;
448
+ const payload = JSON . parse ( request . data ) ;
449
+
450
+ // banner
451
+ expect ( payload . imp [ 0 ] . banner . w ) . to . eql ( 300 ) ;
452
+ expect ( payload . imp [ 0 ] . banner . h ) . to . eql ( 250 ) ;
453
+
454
+ expect ( payload . imp [ 0 ] . banner . format . length ) . to . eql ( 3 ) ;
455
+
456
+ // format[0]
457
+ expect ( payload . imp [ 0 ] . banner . format [ 0 ] . w ) . to . eql ( 300 ) ;
458
+ expect ( payload . imp [ 0 ] . banner . format [ 0 ] . h ) . to . eql ( 250 ) ;
459
+
460
+ // format[1]
461
+ expect ( payload . imp [ 0 ] . banner . format [ 1 ] . w ) . to . eql ( 200 ) ;
462
+ expect ( payload . imp [ 0 ] . banner . format [ 1 ] . h ) . to . eql ( 240 ) ;
463
+
464
+ // format[2]
465
+ expect ( payload . imp [ 0 ] . banner . format [ 2 ] . w ) . to . eql ( 100 ) ;
466
+ expect ( payload . imp [ 0 ] . banner . format [ 2 ] . h ) . to . eql ( 150 ) ;
467
+ } ) ;
411
468
} ) ;
0 commit comments