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

Adnuntius Bid Adapter: bugfix to set undefined if no bids #6662

Merged
merged 6 commits into from
Apr 27, 2021
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
8 changes: 4 additions & 4 deletions modules/adnuntiusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ export const spec = {
} else return response
}, {});

const bidResponse = bidRequest.bid.map(bid => bid.bidId)
.reduce((request, adunitId) =>
request.concat(bidResponsesById[adunitId])
, []);
const bidResponse = bidRequest.bid.map(bid => bid.bidId).reduce((request, adunitId) => {
if (bidResponsesById[adunitId]) { request.push(bidResponsesById[adunitId]) }
return request
}, []);

return bidResponse
},
Expand Down
10 changes: 8 additions & 2 deletions test/spec/modules/adnuntiusBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,15 @@ describe('adnuntiusBidAdapter', function () {
'lineItemId': 'scyjdyv3mzgdsnpf',
'layoutId': 'sw6gtws2rdj1kwby',
'layoutName': 'Responsive image'
}
},

]
},
{
'auId': '000000000008b6bc',
'targetId': '456',
'matchedAdCount': 0,
'responseId': 'adn-rsp-1460129238',
}
]
}
Expand Down Expand Up @@ -115,7 +122,6 @@ describe('adnuntiusBidAdapter', function () {
it('should return valid response when passed valid server response', function () {
const interpretedResponse = spec.interpretResponse(serverResponse, singleBidRequest);
const ad = serverResponse.body.adUnits[0].ads[0]

expect(interpretedResponse).to.have.lengthOf(1);
expect(interpretedResponse[0].cpm).to.equal(ad.cpm.amount);
expect(interpretedResponse[0].width).to.equal(Number(ad.creativeWidth));
Expand Down