Skip to content

Commit

Permalink
Correct Adform adapter bid response adId value (#947)
Browse files Browse the repository at this point in the history
  • Loading branch information
braizhas authored and matthewlane committed Feb 7, 2017
1 parent 1b4eaf0 commit 2f4bb60
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/adapters/adform.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var utils = require('../utils.js');
var adloader = require('../adloader.js');
var bidmanager = require('../bidmanager.js');
var bidfactory = require('../bidfactory.js');
var STATUSCODES = require('../constants.json').STATUS;

function AdformAdapter() {

Expand Down Expand Up @@ -70,7 +71,7 @@ function AdformAdapter() {
if (adItem && adItem.response === 'banner' &&
verifySize(adItem, bid.sizes)) {

bidObject = bidfactory.createBid(1);
bidObject = bidfactory.createBid(STATUSCODES.GOOD, bid);
bidObject.bidderCode = bidder;
bidObject.cpm = adItem.win_bid;
bidObject.cur = adItem.win_cur;
Expand All @@ -80,7 +81,7 @@ function AdformAdapter() {
bidObject.dealId = adItem.deal_id;
bidmanager.addBidResponse(bid.placementCode, bidObject);
} else {
bidObject = bidfactory.createBid(2);
bidObject = bidfactory.createBid(STATUSCODES.NO_BID, bid);
bidObject.bidderCode = bidder;
bidmanager.addBidResponse(bid.placementCode, bidObject);
}
Expand Down
10 changes: 10 additions & 0 deletions test/spec/adapters/adform_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ describe('Adform adapter', () => {
assert.equal(_bidObject.bidderCode, 'adform');
});

it('should correctly set bid response adId', () => {
const addResponse = bidManager.addBidResponse;
assert.equal('abc', addResponse.getCall(0).args[1].adId);
assert.equal('123', addResponse.getCall(1).args[1].adId);
assert.equal('a1b', addResponse.getCall(2).args[1].adId);
});

beforeEach(() => {
sandbox.stub(bidManager, 'addBidResponse');
$$PREBID_GLOBAL$$._adf_callback([
Expand Down Expand Up @@ -112,6 +119,7 @@ describe('Adform adapter', () => {
_adapter.callBids({
bids: [
{
bidId: 'abc',
placementCode: 'code-1',
sizes: [ [ 100, 100], [ 90, 90 ] ],
params: {
Expand All @@ -122,6 +130,7 @@ describe('Adform adapter', () => {
tid: 45
},
{
bidId: '123',
placementCode: 'code-2',
sizes: [ [ 100, 100] ],
params: {
Expand All @@ -131,6 +140,7 @@ describe('Adform adapter', () => {
}
},
{
bidId: 'a1b',
placementCode: 'code-3',
sizes: [ [ 50, 40], [ 40, 50 ] ],
params: {
Expand Down

0 comments on commit 2f4bb60

Please sign in to comment.