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

waardexAdaper, removed placementId from request #5507

Merged
merged 2 commits into from
Jul 24, 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
11 changes: 5 additions & 6 deletions modules/waardexBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ function buildBidRequests(validBidRequests) {

const item = {
bidId: validBidRequest.bidId,
placementId: params.placementId,
bidfloor: parseFloat(params.bidfloor) || 0,
position: parseInt(params.position) || 1,
instl: parseInt(params.instl) || 0,
Expand Down Expand Up @@ -170,7 +169,7 @@ export const spec = {
code: BIDDER_CODE,
supportedMediaTypes: [BANNER],

isBidRequestValid: (bid) => Boolean(bid.bidId && bid.params && +bid.params.placementId && +bid.params.pubId),
isBidRequestValid: (bid) => Boolean(bid.bidId && bid.params && +bid.params.zoneId),

/**
* @param {Object[]} validBidRequests - array of valid bid requests
Expand All @@ -181,12 +180,12 @@ export const spec = {
const payload = getCommonBidsData(bidderRequest);
payload.bidRequests = buildBidRequests(validBidRequests);

let pubId = '';
if (validBidRequests[0] && validBidRequests[0].params && +validBidRequests[0].params.pubId) {
pubId = +validBidRequests[0].params.pubId;
let zoneId = '';
if (validBidRequests[0] && validBidRequests[0].params && +validBidRequests[0].params.zoneId) {
zoneId = +validBidRequests[0].params.zoneId;
}

const url = `${ENDPOINT}?pubId=${pubId}`;
const url = `${ENDPOINT}?pubId=${zoneId}`;

return {
method: 'POST',
Expand Down
19 changes: 6 additions & 13 deletions test/spec/modules/waardexBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,22 @@ describe('waardexBidAdapter', () => {
params: {
placementId: 1,
traffic: 'banner',
pubId: 1,
zoneId: 1,
}
};

describe('isBidRequestValid', () => {
it('Should return true. bidId and params such as placementId and pubId are present', () => {
it('Should return true. bidId and params such as placementId and zoneId are present', () => {
expect(spec.isBidRequestValid(validBid)).to.be.true;
});
it('Should return false. bidId is not present in bid object', () => {
const invalidBid = deepClone(validBid);
delete invalidBid.bidId;
expect(spec.isBidRequestValid(invalidBid)).to.be.false;
});
it('Should return false. placementId is not present in bid.params object', () => {
it('Should return false. zoneId is not present in bid.params object', () => {
const invalidBid = deepClone(validBid);
delete invalidBid.params.placementId;
expect(spec.isBidRequestValid(invalidBid)).to.be.false;
});
it('Should return false. pubId is not present in bid.params object', () => {
const invalidBid = deepClone(validBid);
delete invalidBid.params.pubId;
delete invalidBid.params.zoneId;
expect(spec.isBidRequestValid(invalidBid)).to.be.false;
});
});
Expand All @@ -45,11 +40,10 @@ describe('waardexBidAdapter', () => {
}
},
params: {
placementId: 1,
bidfloor: 1.5,
position: 1,
instl: 1,
pubId: 100
zoneId: 100
},
}];

Expand All @@ -72,7 +66,6 @@ describe('waardexBidAdapter', () => {

expect(payload.bidRequests[0]).deep.equal({
bidId: validBidRequests[0].bidId,
placementId: validBidRequests[0].params.placementId,
bidfloor: validBidRequests[0].params.bidfloor,
position: validBidRequests[0].params.position,
instl: validBidRequests[0].params.instl,
Expand All @@ -89,7 +82,7 @@ describe('waardexBidAdapter', () => {
],
}
});
const ENDPOINT = `https://hb.justbidit.xyz:8843/prebid?pubId=${validBidRequests[0].params.pubId}`;
const ENDPOINT = `https://hb.justbidit.xyz:8843/prebid?pubId=${validBidRequests[0].params.zoneId}`;
expect(url).to.equal(ENDPOINT);
expect(method).to.equal('POST');
});
Expand Down