Skip to content

Commit b9f2c1b

Browse files
rigelbibirigel_home
authored and
BrightMountainMedia
committed
Update the checking rule of bid param for bridgewellBidAdapter (prebid#5736)
* Update the checking rule of bid param for bridgewellBidAdapter * Update bridgewellBidAdapter.js Co-authored-by: rigel_home <[email protected]>
1 parent 8d58217 commit b9f2c1b

File tree

2 files changed

+37
-5
lines changed

2 files changed

+37
-5
lines changed

modules/bridgewellBidAdapter.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import find from 'core-js-pure/features/array/find.js';
55

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

1010
export const spec = {
1111
code: BIDDER_CODE,
@@ -19,11 +19,13 @@ export const spec = {
1919
*/
2020
isBidRequestValid: function (bid) {
2121
let valid = false;
22-
23-
if (bid && bid.params && bid.params.ChannelID) {
24-
valid = true;
22+
if (bid && bid.params) {
23+
if ((bid.params.cid) && (typeof bid.params.cid === 'number')) {
24+
valid = true;
25+
} else if (bid.params.ChannelID) {
26+
valid = true;
27+
}
2528
}
26-
2729
return valid;
2830
},
2931

test/spec/modules/bridgewellBidAdapter_spec.js

+30
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ describe('bridgewellBidAdapter', function () {
2222
expect(spec.isBidRequestValid(validTag)).to.equal(true);
2323
});
2424

25+
it('should return true when required params found', function () {
26+
const validTag = {
27+
'bidder': 'bridgewell',
28+
'params': {
29+
'cid': 1234
30+
},
31+
};
32+
expect(spec.isBidRequestValid(validTag)).to.equal(true);
33+
});
34+
2535
it('should return false when required params not found', function () {
2636
const invalidTag = {
2737
'bidder': 'bridgewell',
@@ -39,6 +49,26 @@ describe('bridgewellBidAdapter', function () {
3949
};
4050
expect(spec.isBidRequestValid(invalidTag)).to.equal(false);
4151
});
52+
53+
it('should return false when required params are empty', function () {
54+
const invalidTag = {
55+
'bidder': 'bridgewell',
56+
'params': {
57+
'cid': '',
58+
},
59+
};
60+
expect(spec.isBidRequestValid(invalidTag)).to.equal(false);
61+
});
62+
63+
it('should return false when required param cid is not a number', function () {
64+
const invalidTag = {
65+
'bidder': 'bridgewell',
66+
'params': {
67+
'cid': 'bad_cid',
68+
},
69+
};
70+
expect(spec.isBidRequestValid(invalidTag)).to.equal(false);
71+
});
4272
});
4373

4474
describe('buildRequests', function () {

0 commit comments

Comments
 (0)