Skip to content

Commit

Permalink
waardexAdaper, removed placementId from request (#5507)
Browse files Browse the repository at this point in the history
* waardexAdaper, removed placementId from request

* Update package-lock.json

Co-authored-by: Max Shuhaliia <mshuhaliia@Maxs-MacBook-Pro-2.local>
  • Loading branch information
mshuhaliia and Max Shuhaliia authored Jul 24, 2020
1 parent accd757 commit a71d376
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
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

0 comments on commit a71d376

Please sign in to comment.