Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update position default value #2214

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion modules/rubiconBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const spec = {
let slotData = {
site_id: params.siteId,
zone_id: params.zoneId,
position: params.position || 'unknown',
position: parsePosition(params.position),
floor: parseFloat(params.floor) > 0.01 ? params.floor : 0.01,
element_id: bidRequest.adUnitCode,
name: bidRequest.adUnitCode,
Expand Down Expand Up @@ -393,6 +393,13 @@ function mapSizes(sizes) {
}, []);
}

function parsePosition(position) {
if (position === 'atf' || position === 'btf') {
return position;
}
return 'unknown';
}

export function masSizeOrdering(sizes) {
const MAS_SIZE_PRIORITY = [15, 2, 9];

Expand Down
44 changes: 44 additions & 0 deletions test/spec/modules/rubiconBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,50 @@ describe('the rubicon adapter', () => {
expect(slot.visitor).to.have.property('lastsearch').that.equals('iphone');
});

it('should send request with proper ad position', () => {
createVideoBidderRequest();
var positionBidderRequest = clone(bidderRequest);
positionBidderRequest.bids[0].params.position = 'atf';
let [request] = spec.buildRequests(positionBidderRequest.bids, positionBidderRequest);
let post = request.data;
let slot = post.slots[0];

expect(slot.position).to.equal('atf');

positionBidderRequest = clone(bidderRequest);
positionBidderRequest.bids[0].params.position = 'btf';
[request] = spec.buildRequests(positionBidderRequest.bids, positionBidderRequest);
post = request.data;
slot = post.slots[0];

expect(slot.position).to.equal('btf');

positionBidderRequest = clone(bidderRequest);
positionBidderRequest.bids[0].params.position = 'unknown';
[request] = spec.buildRequests(positionBidderRequest.bids, positionBidderRequest);
post = request.data;
slot = post.slots[0];

expect(slot.position).to.equal('unknown');

positionBidderRequest = clone(bidderRequest);
positionBidderRequest.bids[0].params.position = '123';
[request] = spec.buildRequests(positionBidderRequest.bids, positionBidderRequest);
post = request.data;
slot = post.slots[0];

expect(slot.position).to.equal('unknown');

positionBidderRequest = clone(bidderRequest);
delete positionBidderRequest.bids[0].params.position;
expect(positionBidderRequest.bids[0].params.position).to.equal(undefined);
[request] = spec.buildRequests(positionBidderRequest.bids, positionBidderRequest);
post = request.data;
slot = post.slots[0];

expect(slot.position).to.equal('unknown');
});

it('should allow a floor price override', () => {
createVideoBidderRequest();

Expand Down