Skip to content

Commit

Permalink
Set bid response ID to bid request ID for AOL
Browse files Browse the repository at this point in the history
  • Loading branch information
marian-r committed Oct 12, 2016
1 parent 67c307a commit 38bd3ae
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/adapters/aol.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ var AolAdapter = function AolAdapter() {
}

function _addErrorBidResponse(bid, response = {}) {
var bidResponse = bidfactory.createBid(2);
const bidResponse = bidfactory.createBid(2, bid);
bidResponse.bidderCode = BIDDER_CODE;
bidResponse.reason = response.nbr;
bidResponse.raw = response;
Expand Down Expand Up @@ -97,7 +97,7 @@ var AolAdapter = function AolAdapter() {
ad += bidData.ext.pixels;
}

var bidResponse = bidfactory.createBid(1);
const bidResponse = bidfactory.createBid(1, bid);
bidResponse.bidderCode = BIDDER_CODE;
bidResponse.ad = ad;
bidResponse.cpm = cpm;
Expand Down
22 changes: 22 additions & 0 deletions test/spec/adapters/aol_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,15 @@ describe('AolAdapter', () => {
expect(bidmanager.addBidResponse.firstCall.args[1]).to.have.property('bidderCode', 'aol');
});

it('should have adId matching the bidId from related bid request', () => {
server.respondWith(JSON.stringify(DEFAULT_PUBAPI_RESPONSE));
adapter.callBids(DEFAULT_BIDDER_REQUEST);
server.respond();
expect(bidmanager.addBidResponse.calledOnce).to.be.true;
expect(bidmanager.addBidResponse.firstCall.args[1])
.to.have.property('adId', DEFAULT_BIDDER_REQUEST.bids[0].bidId);
});

it('should be added to bidmanager as invalid in case of empty response', () => {
server.respondWith('');
adapter.callBids(DEFAULT_BIDDER_REQUEST);
Expand Down Expand Up @@ -272,6 +281,19 @@ describe('AolAdapter', () => {
expect(bidmanager.addBidResponse.firstCall.args[1].getStatusCode()).to.equal(2);
});

it('should have adId matching the bidId from bid request in case of no bid data', () => {
server.respondWith(JSON.stringify({
"id": "245730051428950632",
"cur": "USD",
"seatbid": []
}));
adapter.callBids(DEFAULT_BIDDER_REQUEST);
server.respond();
expect(bidmanager.addBidResponse.calledOnce).to.be.true;
expect(bidmanager.addBidResponse.firstCall.args[1])
.to.have.property('adId', DEFAULT_BIDDER_REQUEST.bids[0].bidId);
});

it('should be added to bidmanager as invalid in case of empty price', () => {
server.respondWith(JSON.stringify({
"id": "245730051428950632",
Expand Down

0 comments on commit 38bd3ae

Please sign in to comment.