@@ -163,6 +163,55 @@ describe('freedomadnetworkAdapter', function() {
163
163
expect ( impVideo . bidfloor ) . to . equal ( parseFloat ( videoBid . params . bidFloor ) ) ;
164
164
expect ( impVideo . bidfloorcur ) . to . equal ( videoBid . params . bidFloorCur ) ;
165
165
} ) ;
166
+
167
+ describe ( 'PriceFloors module support' , function ( ) {
168
+ it ( 'should not set `imp[]bidfloor` property when priceFloors module is not available' , function ( ) {
169
+ const bidTest = JSON . parse ( JSON . stringify ( validBidRequestBanner ) ) ;
170
+ const requests = spec . buildRequests ( [ bidTest ] , bidderRequest ) ;
171
+
172
+ const data = requests [ 0 ] . data ;
173
+ expect ( data . imp [ 0 ] . banner ) . to . exist ;
174
+ expect ( data . imp [ 0 ] . bidfloor ) . to . not . exist ;
175
+ } ) ;
176
+
177
+ it ( 'should not set `imp[]bidfloor` property when priceFloors module returns false' , function ( ) {
178
+ const bidTest = JSON . parse ( JSON . stringify ( validBidRequestBanner ) ) ;
179
+ bidTest . getFloor = ( ) => {
180
+ return false ;
181
+ } ;
182
+
183
+ const requests = spec . buildRequests ( [ bidTest ] , bidderRequest ) ;
184
+
185
+ const data = requests [ 0 ] . data ;
186
+ expect ( data . imp [ 0 ] . banner ) . to . exist ;
187
+ expect ( data . imp [ 0 ] . bidfloor ) . to . not . exist ;
188
+ } ) ;
189
+
190
+ it ( 'should get the highest floorPrice found when bid have several mediaTypes' , function ( ) {
191
+ const getFloorTest = ( options ) => {
192
+ switch ( options . mediaType ) {
193
+ case BANNER :
194
+ return { floor : 1 , currency : DEFAULT_CURRENCY } ;
195
+ default :
196
+ return false ;
197
+ }
198
+ } ;
199
+
200
+ const bidTest = JSON . parse ( JSON . stringify ( validBidRequestBanner ) ) ;
201
+
202
+ bidTest . mediaTypes . video = {
203
+ playerSize : [ 600 , 480 ] ,
204
+ } ;
205
+
206
+ bidTest . getFloor = getFloorTest ;
207
+
208
+ const requests = spec . buildRequests ( [ bidTest ] , bidderRequest ) ;
209
+
210
+ const data = requests [ 0 ] . data ;
211
+ expect ( data . imp [ 0 ] . banner ) . to . exist ;
212
+ expect ( data . imp [ 0 ] . bidfloor ) . to . equal ( 1 ) ;
213
+ } ) ;
214
+ } ) ;
166
215
} ) ;
167
216
168
217
describe ( 'interpretResponse' , function ( ) {
0 commit comments