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

#943 correct Adform adapter bid response adId value #947

Merged
merged 1 commit into from
Feb 7, 2017
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
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