Skip to content

Commit c0d71e5

Browse files
committed
Added support for getFloor().
1 parent 226e33f commit c0d71e5

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

test/spec/modules/fanBidAdapter_spec.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,55 @@ describe('freedomadnetworkAdapter', function() {
163163
expect(impVideo.bidfloor).to.equal(parseFloat(videoBid.params.bidFloor));
164164
expect(impVideo.bidfloorcur).to.equal(videoBid.params.bidFloorCur);
165165
});
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+
});
166215
});
167216

168217
describe('interpretResponse', function() {

0 commit comments

Comments
 (0)