Skip to content

Commit

Permalink
Merge pull request #7 from yieldmo/FS-7762
Browse files Browse the repository at this point in the history
updates bidder module to be 3.0 compliant, and tests
  • Loading branch information
HolzAndrew authored Oct 28, 2019
2 parents c1f47bf + 217eb0c commit eeff0f4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion modules/yieldmoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function addPlacement(request) {
const placementInfo = {
placement_id: request.adUnitCode,
callback_id: request.bidId,
sizes: request.sizes
sizes: request.mediaTypes.banner.sizes
}
if (request.params) {
if (request.params.placementId) {
Expand Down
28 changes: 22 additions & 6 deletions test/spec/modules/yieldmoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ describe('YieldmoAdapter', function () {
bidFloor: 0.1
},
adUnitCode: 'adunit-code',
sizes: [[300, 250], [300, 600]],
mediaTypes: {
banner: {
sizes: [[300, 250], [300, 600]]
}
},
bidId: '30b31c1838de1e',
bidderRequestId: '22edbae2733bf6',
auctionId: '1d1a030790a475',
Expand Down Expand Up @@ -76,15 +80,19 @@ describe('YieldmoAdapter', function () {

it('should place bid information into the p parameter of data', function () {
let placementInfo = spec.buildRequests(bidArray, bidderRequest).data.p;
expect(placementInfo).to.equal('[{"placement_id":"adunit-code","callback_id":"30b31c1838de1e","sizes":[[300,250],[300,600]],"bidFloor":0.1}]');
expect(placementInfo).to.equal('[{"placement_id":"adunit-code","callback_id":"30b31c1838de1e","mediaTypes":{"banner":{"sizes":[[300,250],[300,600]]}},"bidFloor":0.1}]');

bidArray.push({
bidder: 'yieldmo',
params: {
bidFloor: 0.2
},
adUnitCode: 'adunit-code-1',
sizes: [[300, 250], [300, 600]],
mediaTypes: {
banner: {
sizes: [[300, 250], [300, 600]]
}
},
bidId: '123456789',
bidderRequestId: '987654321',
auctionId: '0246810',
Expand All @@ -96,7 +104,7 @@ describe('YieldmoAdapter', function () {

// multiple placements
placementInfo = spec.buildRequests(bidArray, bidderRequest).data.p;
expect(placementInfo).to.equal('[{"placement_id":"adunit-code","callback_id":"30b31c1838de1e","sizes":[[300,250],[300,600]],"bidFloor":0.1},{"placement_id":"adunit-code-1","callback_id":"123456789","sizes":[[300,250],[300,600]],"bidFloor":0.2}]');
expect(placementInfo).to.equal('[{"placement_id":"adunit-code","callback_id":"30b31c1838de1e","mediaTypes":{"banner":{sizes":[[300,250],[300,600]]}},"bidFloor":0.1},{"placement_id":"adunit-code-1","callback_id":"123456789","mediaTypes":{"banner":{"sizes":[[300,250],[300,600]]}},"bidFloor":0.2}]');
});

it('should add placement id if given', function () {
Expand Down Expand Up @@ -131,7 +139,11 @@ describe('YieldmoAdapter', function () {
bidder: 'yieldmo',
params: {},
adUnitCode: 'adunit-code',
sizes: [[300, 250], [300, 600]],
mediaTypes: {
banner: {
sizes: [[300, 250], [300, 600]]
}
},
bidId: '30b31c1838de1e',
bidderRequestId: '22edbae2733bf6',
auctionId: '1d1a030790a475',
Expand All @@ -148,7 +160,11 @@ describe('YieldmoAdapter', function () {
bidder: 'yieldmo',
params: {},
adUnitCode: 'adunit-code',
sizes: [[300, 250], [300, 600]],
mediaTypes: {
banner: {
sizes: [[300, 250], [300, 600]]
}
},
bidId: '30b31c1838de1e',
bidderRequestId: '22edbae2733bf6',
auctionId: '1d1a030790a475',
Expand Down

0 comments on commit eeff0f4

Please sign in to comment.