Skip to content

Commit

Permalink
clear size param
Browse files Browse the repository at this point in the history
  • Loading branch information
vladis-teqblaze committed Mar 19, 2018
1 parent 517b29a commit 61a795e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 42 deletions.
36 changes: 1 addition & 35 deletions modules/colossussspBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,6 @@ const BIDDER_CODE = 'colossusssp';
const URL = '//colossusssp.com/?c=o&m=multi';
const URL_SYNC = '//colossusssp.com/?c=o&m=cookie';

let sizeObj = {
'468x60': 1,
'728x90': 2,
'300x600': 10,
'300x250': 15,
'300x100': 19,
'320x50': 43,
'300x50': 44,
'300x300': 48,
'300x1050': 54,
'970x90': 55,
'970x250': 57,
'1000x90': 58,
'320x80': 59,
'640x480': 65,
'320x480': 67,
'320x320': 72,
'320x160': 73,
'480x300': 83,
'970x310': 94,
'970x210': 96,
'480x320': 101,
'768x1024': 102,
'1000x300': 113,
'320x100': 117,
'800x250': 118,
'200x600': 119
};

utils._each(sizeObj, (item, key) => sizeObj[item] = key);

function isBidResponseValid(bid) {
if (!bid.requestId || !bid.cpm || !bid.creativeId || !bid.ttl || !bid.currency) {
return false;
Expand Down Expand Up @@ -64,9 +33,7 @@ export const spec = {
* @return boolean True if this is a valid bid, and false otherwise.
*/
isBidRequestValid: (bid) => {
return (!isNaN(bid.params.placement_id) &&
((bid.params.sizes !== undefined && bid.params.sizes.length > 0 && bid.params.sizes.some((sizeIndex) => sizeObj[sizeIndex] !== undefined)) ||
(bid.sizes !== undefined && bid.sizes.length > 0 && bid.sizes.map((size) => `${size[0]}x${size[1]}`).some((size) => sizeObj[size] !== undefined))));
return Boolean(bid.bidId && bid.params && !isNaN(bid.params.placement_id));
},

/**
Expand Down Expand Up @@ -99,7 +66,6 @@ export const spec = {
let placement = {
placementId: bid.params.placement_id,
bidId: bid.bidId,
sizes: bid.sizes,
traffic: bid.params.traffic || BANNER
};
placements.push(placement);
Expand Down
10 changes: 3 additions & 7 deletions test/spec/modules/colossussspBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,13 @@ describe('ColossussspAdapter', () => {
};

describe('isBidRequestValid', () => {
it('Should return true when placement_id can be cast to a number, and when at least one of the sizes passed is allowed', () => {
it('Should return true when placement_id can be cast to a number', () => {
expect(spec.isBidRequestValid(bid)).to.be.true;
});
it('Should return false when placement_id is not a number', () => {
bid.params.placement_id = 'aaa';
expect(spec.isBidRequestValid(bid)).to.be.false;
});
it('Should return false when the sizes are not allowed', () => {
bid.sizes = [[1, 1]];
expect(spec.isBidRequestValid(bid)).to.be.false;
});
});

describe('buildRequests', () => {
Expand Down Expand Up @@ -56,10 +52,10 @@ describe('ColossussspAdapter', () => {
let placements = data['placements'];
for (let i = 0; i < placements.length; i++) {
let placement = placements[i];
expect(placement).to.have.all.keys('placementId', 'bidId', 'sizes', 'traffic');
expect(placement).to.have.all.keys('placementId', 'bidId', 'traffic');
expect(placement.placementId).to.be.a('number');
expect(placement.bidId).to.be.a('string');
expect(placement.sizes).to.be.an('array');
expect(placement.traffic).to.be.a('string');
}
});
it('Returns empty data if no valid requests are passed', () => {
Expand Down

0 comments on commit 61a795e

Please sign in to comment.