Skip to content

Commit

Permalink
Adnuntius Bid Adapter: bugfix to set undefined if no bids (prebid#6662)
Browse files Browse the repository at this point in the history
* RTD Provider rebase

* wrongly merged to master

* Added meta field for advertiser domains.

* Fixing bug where losing bids throw undefined into the response.

* Wrapped if-statement
  • Loading branch information
mikael-lundin authored and stsepelin committed May 28, 2021
1 parent fdbafae commit e7b8e89
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
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

0 comments on commit e7b8e89

Please sign in to comment.