@@ -280,6 +280,44 @@ describe('sharethrough adapter spec', function () {
280
280
}
281
281
} ) ;
282
282
} ) ;
283
+
284
+ it ( 'should add a supply chain parameter if schain is present' , function ( ) {
285
+ // shallow copy of the first bidRequest obj, so we don't mutate
286
+ const bidRequest = Object . assign ( { } , bidRequests [ 0 ] ) ;
287
+ bidRequest [ 'schain' ] = {
288
+ ver : '1.0' ,
289
+ complete : 1 ,
290
+ nodes : [
291
+ {
292
+ asi : 'directseller.com' ,
293
+ sid : '00001' ,
294
+ rid : 'BidRequest1' ,
295
+ hp : 1
296
+ }
297
+ ]
298
+ } ;
299
+
300
+ const builtBidRequest = spec . buildRequests ( [ bidRequest ] ) [ 0 ] ;
301
+ expect ( builtBidRequest . data . schain ) . to . eq ( JSON . stringify ( bidRequest . schain ) ) ;
302
+ } ) ;
303
+
304
+ it ( 'should not add a supply chain parameter if schain is missing' , function ( ) {
305
+ const bidRequest = spec . buildRequests ( bidRequests ) [ 0 ] ;
306
+ expect ( bidRequest . data ) . to . not . include . any . keys ( 'schain' ) ;
307
+ } ) ;
308
+
309
+ it ( 'should include the bidfloor parameter if it is present in the bid request' , function ( ) {
310
+ const bidRequest = Object . assign ( { } , bidRequests [ 0 ] ) ;
311
+ bidRequest [ 'bidfloor' ] = 0.50 ;
312
+ const builtBidRequest = spec . buildRequests ( [ bidRequest ] ) [ 0 ] ;
313
+ expect ( builtBidRequest . data . bidfloor ) . to . eq ( 0.5 ) ;
314
+ } ) ;
315
+
316
+ it ( 'should not include the bidfloor parameter if it is missing in the bid request' , function ( ) {
317
+ const bidRequest = Object . assign ( { } , bidRequests [ 0 ] ) ;
318
+ const builtBidRequest = spec . buildRequests ( [ bidRequest ] ) [ 0 ] ;
319
+ expect ( builtBidRequest . data ) . to . not . include . any . keys ( 'bidfloor' ) ;
320
+ } ) ;
283
321
} ) ;
284
322
285
323
describe ( '.interpretResponse' , function ( ) {
0 commit comments