@@ -6,6 +6,11 @@ import {deepClone} from 'src/utils.js';
6
6
describe ( 'PulsePoint Adapter Tests' , function ( ) {
7
7
const slotConfigs = [ {
8
8
placementCode : '/DfpAccount1/slot1' ,
9
+ mediaTypes : {
10
+ banner : {
11
+ sizes : [ [ 728 , 90 ] , [ 160 , 600 ] ]
12
+ }
13
+ } ,
9
14
bidId : 'bid12345' ,
10
15
params : {
11
16
cp : 'p10000' ,
@@ -655,4 +660,45 @@ describe('PulsePoint Adapter Tests', function () {
655
660
userVerify ( ortbRequest . user . ext . eids [ 4 ] , 'parrable.com' , 'parrable_id234' ) ;
656
661
userVerify ( ortbRequest . user . ext . eids [ 5 ] , 'liveintent.com' , 'liveintent_id123' ) ;
657
662
} ) ;
663
+ it ( 'Verify multiple adsizes' , function ( ) {
664
+ const bidRequests = deepClone ( slotConfigs ) ;
665
+ const request = spec . buildRequests ( bidRequests , bidderRequest ) ;
666
+ expect ( request ) . to . be . not . null ;
667
+ expect ( request . data ) . to . be . not . null ;
668
+ const ortbRequest = request . data ;
669
+ expect ( ortbRequest . imp ) . to . have . lengthOf ( 2 ) ;
670
+ // first impression has multi sizes
671
+ expect ( ortbRequest . imp [ 0 ] . banner ) . to . not . be . null ;
672
+ expect ( ortbRequest . imp [ 0 ] . banner . w ) . to . equal ( 300 ) ;
673
+ expect ( ortbRequest . imp [ 0 ] . banner . h ) . to . equal ( 250 ) ;
674
+ expect ( ortbRequest . imp [ 0 ] . banner . format ) . to . not . be . null ;
675
+ expect ( ortbRequest . imp [ 0 ] . banner . format ) . to . have . lengthOf ( 2 ) ;
676
+ expect ( ortbRequest . imp [ 0 ] . banner . format [ 0 ] . w ) . to . equal ( 728 ) ;
677
+ expect ( ortbRequest . imp [ 0 ] . banner . format [ 0 ] . h ) . to . equal ( 90 ) ;
678
+ expect ( ortbRequest . imp [ 0 ] . banner . format [ 1 ] . w ) . to . equal ( 160 ) ;
679
+ expect ( ortbRequest . imp [ 0 ] . banner . format [ 1 ] . h ) . to . equal ( 600 ) ;
680
+ // slot 2
681
+ expect ( ortbRequest . imp [ 1 ] . banner ) . to . not . be . null ;
682
+ expect ( ortbRequest . imp [ 1 ] . banner . w ) . to . equal ( 728 ) ;
683
+ expect ( ortbRequest . imp [ 1 ] . banner . h ) . to . equal ( 90 ) ;
684
+ expect ( ortbRequest . imp [ 1 ] . banner . format ) . to . be . null ;
685
+ // adsize on response
686
+ const ortbResponse = {
687
+ seatbid : [ {
688
+ bid : [ {
689
+ impid : ortbRequest . imp [ 0 ] . id ,
690
+ price : 1.25 ,
691
+ adm : 'This is an Ad' ,
692
+ crid : 'Creative#123' ,
693
+ w : 728 ,
694
+ h : 90
695
+ } ]
696
+ } ]
697
+ } ;
698
+ const bids = spec . interpretResponse ( { body : ortbResponse } , request ) ;
699
+ expect ( bids ) . to . have . lengthOf ( 1 ) ;
700
+ const bid = bids [ 0 ] ;
701
+ expect ( bid . width ) . to . equal ( 728 ) ;
702
+ expect ( bid . height ) . to . equal ( 90 ) ;
703
+ } ) ;
658
704
} ) ;
0 commit comments