33 spec ,
44 getBidFloor as connatixGetBidFloor
55} from '../../../modules/connatixBidAdapter.js' ;
6- import { BANNER } from '../../../src/mediaTypes.js' ;
6+ import { ADPOD , BANNER , VIDEO } from '../../../src/mediaTypes.js' ;
77
88describe ( 'connatixBidAdapter' , function ( ) {
99 let bid ;
@@ -24,6 +24,26 @@ describe('connatixBidAdapter', function () {
2424 } ;
2525 } ;
2626
27+ function addVideoToBidMock ( bid ) {
28+ const mediaTypes = {
29+ video : {
30+ context : 'instream' ,
31+ w : 1280 ,
32+ h : 720 ,
33+ playerSize : [ 1280 , 720 ] ,
34+ placement : 1 ,
35+ plcmt : 1 ,
36+ api : [ 1 , 2 ] ,
37+ mimes : [ 'video/mp4' , 'application/javascript' ] ,
38+ minduration : 30 ,
39+ maxduration : 60 ,
40+ startdelay : 0 ,
41+ }
42+ }
43+
44+ bid . mediaTypes = mediaTypes ;
45+ }
46+
2747 describe ( 'isBidRequestValid' , function ( ) {
2848 this . beforeEach ( function ( ) {
2949 bid = mockBidRequest ( ) ;
@@ -52,7 +72,7 @@ describe('connatixBidAdapter', function () {
5272 delete bid . mediaTypes ;
5373 expect ( spec . isBidRequestValid ( bid ) ) . to . be . false ;
5474 } ) ;
55- it ( 'Should return false if banner is missing from mediaTypes ' , function ( ) {
75+ it ( 'Should return false if both banner and video are missing from mediaTypes' , function ( ) {
5676 delete bid . mediaTypes . banner ;
5777 expect ( spec . isBidRequestValid ( bid ) ) . to . be . false ;
5878 } ) ;
@@ -68,6 +88,15 @@ describe('connatixBidAdapter', function () {
6888 bid . mediaTypes . banner . sizes = [ ] ;
6989 expect ( spec . isBidRequestValid ( bid ) ) . to . be . false ;
7090 } ) ;
91+ it ( 'Should return true if video is set correctly' , function ( ) {
92+ addVideoToBidMock ( bid ) ;
93+ expect ( spec . isBidRequestValid ( bid ) ) . to . be . true ;
94+ } ) ;
95+ it ( 'Should return false if context is set to adpod on video media type' , function ( ) {
96+ addVideoToBidMock ( bid ) ;
97+ bid . mediaTypes . video . context = ADPOD ;
98+ expect ( spec . isBidRequestValid ( bid ) ) . to . be . false ;
99+ } ) ;
71100 it ( 'Should return true if add an extra field was added to the bidRequest' , function ( ) {
72101 bid . params . test = 1 ;
73102 expect ( spec . isBidRequestValid ( bid ) ) . to . be . true ;
@@ -197,6 +226,30 @@ describe('connatixBidAdapter', function () {
197226 expect ( bidResponses [ 0 ] . cpm ) . to . equal ( firstBidCpm ) ;
198227 expect ( bidResponses [ 1 ] . cpm ) . to . equal ( secondBidCpm ) ;
199228 } ) ;
229+
230+ it ( 'Should contain specific values for banner bids' , function ( ) {
231+ const adHtml = 'ad html'
232+ serverResponse . body . Bids = [ { ...Bid , Ad : adHtml } ] ;
233+
234+ const bidResponses = spec . interpretResponse ( serverResponse ) ;
235+ const [ bidResponse ] = bidResponses ;
236+
237+ expect ( bidResponse . vastXml ) . to . be . undefined ;
238+ expect ( bidResponse . ad ) . to . equal ( adHtml ) ;
239+ expect ( bidResponse . mediaType ) . to . equal ( BANNER ) ;
240+ } ) ;
241+
242+ it ( 'Should contain specific values for video bids' , function ( ) {
243+ const adVastXml = 'ad vast xml'
244+ serverResponse . body . Bids = [ { ...Bid , VastXml : adVastXml } ] ;
245+
246+ const bidResponses = spec . interpretResponse ( serverResponse ) ;
247+ const [ bidResponse ] = bidResponses ;
248+
249+ expect ( bidResponse . ad ) . to . be . undefined ;
250+ expect ( bidResponse . vastXml ) . to . equal ( adVastXml ) ;
251+ expect ( bidResponse . mediaType ) . to . equal ( VIDEO ) ;
252+ } ) ;
200253 } ) ;
201254
202255 describe ( 'getUserSyncs' , function ( ) {
0 commit comments