From 26d792bf74076e9fb75afbe645771af8acdfb861 Mon Sep 17 00:00:00 2001 From: rigel_home Date: Sat, 12 Sep 2020 14:25:38 +0800 Subject: [PATCH 1/2] Update the checking rule of bid param for bridgewellBidAdapter --- modules/bridgewellBidAdapter.js | 11 ++++--- .../spec/modules/bridgewellBidAdapter_spec.js | 30 +++++++++++++++++++ 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/modules/bridgewellBidAdapter.js b/modules/bridgewellBidAdapter.js index 0303e4f74bd..611839e50ca 100644 --- a/modules/bridgewellBidAdapter.js +++ b/modules/bridgewellBidAdapter.js @@ -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, @@ -20,10 +20,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; }, diff --git a/test/spec/modules/bridgewellBidAdapter_spec.js b/test/spec/modules/bridgewellBidAdapter_spec.js index 644f468abe8..fea2454393d 100644 --- a/test/spec/modules/bridgewellBidAdapter_spec.js +++ b/test/spec/modules/bridgewellBidAdapter_spec.js @@ -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', @@ -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 () { From 7b7be23be89b3956f08823ca037e0ac1bb65bae3 Mon Sep 17 00:00:00 2001 From: Rigel Cheng Date: Sat, 12 Sep 2020 18:08:59 +0800 Subject: [PATCH 2/2] Update bridgewellBidAdapter.js --- modules/bridgewellBidAdapter.js | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/bridgewellBidAdapter.js b/modules/bridgewellBidAdapter.js index 611839e50ca..a2d3a2e70a2 100644 --- a/modules/bridgewellBidAdapter.js +++ b/modules/bridgewellBidAdapter.js @@ -19,7 +19,6 @@ export const spec = { */ isBidRequestValid: function (bid) { let valid = false; - if (bid && bid.params) { if ((bid.params.cid) && (typeof bid.params.cid === 'number')) { valid = true;