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

Discovery Bid Adapter : not filter params #10965

Merged
merged 5 commits into from
Jan 25, 2024
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
4 changes: 3 additions & 1 deletion modules/discoveryBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ export const spec = {
if (bid.params.badv) {
globals['badv'] = Array.isArray(bid.params.badv) ? bid.params.badv : [];
}
return !!(bid.params.token && bid.params.publisher && bid.params.tagid);
return true;
},

/**
Expand All @@ -522,6 +522,8 @@ export const spec = {
* @return ServerRequest Info describing the request to the server.
*/
buildRequests: function (validBidRequests, bidderRequest) {
if (!globals['token']) return;

let payload = getParam(validBidRequests, bidderRequest);

const payloadString = JSON.stringify(payload);
Expand Down
80 changes: 80 additions & 0 deletions test/spec/modules/discoveryBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,77 @@ describe('discovery:BidAdapterTests', function () {
};
let request = [];

let bidRequestDataNoParams = {
bidderCode: 'discovery',
auctionId: 'ff66e39e-4075-4d18-9854-56fde9b879ac',
bidderRequestId: '4fec04e87ad785',
bids: [
{
bidder: 'discovery',
params: {
referrer: 'https://discovery.popin.cc',
},
refererInfo: {
page: 'https://discovery.popin.cc',
stack: [
'a.com',
'b.com'
]
},
mediaTypes: {
banner: {
sizes: [[300, 250]],
pos: 'left',
},
},
ortb2: {
user: {
ext: {
data: {
CxSegments: []
}
}
},
site: {
domain: 'discovery.popin.cc',
publisher: {
domain: 'discovery.popin.cc'
},
page: 'https://discovery.popin.cc',
cat: ['IAB-19', 'IAB-20'],
},
},
ortb2Imp: {
ext: {
gpid: 'adslot_gpid',
tid: 'tid_01',
data: {
browsi: {
browsiViewability: 'NA',
},
adserver: {
name: 'adserver_name',
adslot: 'adslot_name',
},
keywords: ['travel', 'sport'],
pbadslot: '202309999'
}
}
},
adUnitCode: 'regular_iframe',
transactionId: 'd163f9e2-7ecd-4c2c-a3bd-28ceb52a60ee',
sizes: [[300, 250]],
bidId: '276092a19e05eb',
bidderRequestId: '1fadae168708b',
auctionId: 'ff66e39e-4075-4d18-9854-56fde9b879ac',
src: 'client',
bidRequestsCount: 1,
bidderRequestsCount: 1,
bidderWinsCount: 0,
},
],
};

it('discovery:validate_pub_params', function () {
expect(
spec.isBidRequestValid({
Expand All @@ -93,6 +164,15 @@ describe('discovery:BidAdapterTests', function () {
).to.equal(true);
});

it('isBidRequestValid:no_params', function () {
expect(
spec.isBidRequestValid({
bidder: 'discovery',
params: {},
})
).to.equal(true);
});

it('discovery:validate_generated_params', function () {
request = spec.buildRequests(bidRequestData.bids, bidRequestData);
let req_data = JSON.parse(request.data);
Expand Down