Skip to content

Commit

Permalink
+ fixed endpoint request data property names - width to w and height …
Browse files Browse the repository at this point in the history
…to h (prebid#1955)

+ updated unit test for the adapter to comply with the property name changes
  • Loading branch information
optimatic58 authored and Justas Pupelis committed Jan 10, 2018
1 parent 3caf481 commit 49668ec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions modules/optimaticBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ function getData (bid) {
bidfloor: bid.params.bidfloor,
video: {
mimes: ['video/mp4', 'video/ogg', 'video/webm', 'video/x-flv', 'application/javascript', 'application/x-shockwave-flash'],
width: size.width,
height: size.height
w: size.width,
h: size.height
}
}],
site: {
Expand Down
16 changes: 8 additions & 8 deletions test/spec/modules/optimaticBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ describe('OptimaticBidAdapter', () => {
const requests = spec.buildRequests([ bidRequest ]);
const data = requests[0].data;
const [ width, height ] = bidRequest.sizes;
expect(data.imp[0].video.width).to.equal(width);
expect(data.imp[0].video.height).to.equal(height);
expect(data.imp[0].video.w).to.equal(width);
expect(data.imp[0].video.h).to.equal(height);
expect(data.imp[0].bidfloor).to.equal(bidRequest.params.bidfloor);
});

Expand All @@ -77,8 +77,8 @@ describe('OptimaticBidAdapter', () => {
bidRequest.sizes = [[ width, height ]];
const requests = spec.buildRequests([ bidRequest ]);
const data = requests[0].data;
expect(data.imp[0].video.width).to.equal(width);
expect(data.imp[0].video.height).to.equal(height);
expect(data.imp[0].video.w).to.equal(width);
expect(data.imp[0].video.h).to.equal(height);
});

it('must parse bid size from a string', () => {
Expand All @@ -87,16 +87,16 @@ describe('OptimaticBidAdapter', () => {
bidRequest.sizes = `${width}x${height}`;
const requests = spec.buildRequests([ bidRequest ]);
const data = requests[0].data;
expect(data.imp[0].video.width).to.equal(width);
expect(data.imp[0].video.height).to.equal(height);
expect(data.imp[0].video.w).to.equal(width);
expect(data.imp[0].video.h).to.equal(height);
});

it('must handle an empty bid size', () => {
bidRequest.sizes = [];
const requests = spec.buildRequests([ bidRequest ]);
const data = requests[0].data;
expect(data.imp[0].video.width).to.equal(undefined);
expect(data.imp[0].video.height).to.equal(undefined);
expect(data.imp[0].video.w).to.equal(undefined);
expect(data.imp[0].video.h).to.equal(undefined);
});
});

Expand Down

0 comments on commit 49668ec

Please sign in to comment.