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 the checking rule of bid param for bridgewellBidAdapter #5736

Merged
merged 2 commits into from
Sep 14, 2020
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
12 changes: 7 additions & 5 deletions modules/bridgewellBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import find from 'core-js-pure/features/array/find.js';

const BIDDER_CODE = 'bridgewell';
const REQUEST_ENDPOINT = 'https://prebid.scupio.com/recweb/prebid.aspx?cb=' + Math.random();
const BIDDER_VERSION = '0.0.2';
const BIDDER_VERSION = '0.0.3';

export const spec = {
code: BIDDER_CODE,
Expand All @@ -19,11 +19,13 @@ export const spec = {
*/
isBidRequestValid: function (bid) {
let valid = false;

if (bid && bid.params && bid.params.ChannelID) {
valid = true;
if (bid && bid.params) {
if ((bid.params.cid) && (typeof bid.params.cid === 'number')) {
valid = true;
} else if (bid.params.ChannelID) {
valid = true;
}
}

return valid;
},

Expand Down
30 changes: 30 additions & 0 deletions test/spec/modules/bridgewellBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ describe('bridgewellBidAdapter', function () {
expect(spec.isBidRequestValid(validTag)).to.equal(true);
});

it('should return true when required params found', function () {
const validTag = {
'bidder': 'bridgewell',
'params': {
'cid': 1234
},
};
expect(spec.isBidRequestValid(validTag)).to.equal(true);
});

it('should return false when required params not found', function () {
const invalidTag = {
'bidder': 'bridgewell',
Expand All @@ -39,6 +49,26 @@ describe('bridgewellBidAdapter', function () {
};
expect(spec.isBidRequestValid(invalidTag)).to.equal(false);
});

it('should return false when required params are empty', function () {
const invalidTag = {
'bidder': 'bridgewell',
'params': {
'cid': '',
},
};
expect(spec.isBidRequestValid(invalidTag)).to.equal(false);
});

it('should return false when required param cid is not a number', function () {
const invalidTag = {
'bidder': 'bridgewell',
'params': {
'cid': 'bad_cid',
},
};
expect(spec.isBidRequestValid(invalidTag)).to.equal(false);
});
});

describe('buildRequests', function () {
Expand Down