Skip to content

Commit

Permalink
Add trafficSourceCode + test (prebid#1184)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Kendall authored and John Salis committed May 19, 2017
1 parent 3b0082b commit 3c2027a
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/adapters/appnexus.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ AppNexusAdapter = function AppNexusAdapter() {
}

jptCall = utils.tryAppendQueryString(jptCall, 'code', inventoryCode);
jptCall = utils.tryAppendQueryString(jptCall, 'traffic_source_code', (utils.getBidIdParameter('trafficSourceCode', bid.params)));

//sizes takes a bit more logic
var sizeQueryString = '';
Expand Down
43 changes: 43 additions & 0 deletions test/spec/adapters/appnexus_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import {expect} from 'chai';
import Adapter from '../../../src/adapters/appnexus';
import bidManager from '../../../src/bidmanager';
import adLoader from '../../../src/adloader';

describe('AppNexus Adapter', () => {

let adapter;

const REQUEST = {
'bidderCode': 'appnexus',
'requestId': 'd3e07445-ab06-44c8-a9dd-5ef9af06d2a6',
'bidderRequestId': '7101db09af0db2',
'bids': [
{
'bidder': 'appnexus',
'params': {
'placementId': '4799418',
'trafficSourceCode' : 'source'
},
'placementCode': '/19968336/header-bid-tag1',
'sizes': [
[728, 90],
[970, 90]
],
'bidId': '84ab500420319d',
'bidderRequestId': '7101db09af0db2',
'requestId': 'd3e07445-ab06-44c8-a9dd-5ef9af06d2a6'
}
],
'start': 1469479810130
};

sinon.stub(bidManager, 'addBidResponse');
const adLoaderStub = sinon.stub(adLoader, 'loadScript');

describe('callBids', () => {
adapter = new Adapter();
adapter.callBids(REQUEST);
expect(adLoaderStub.getCall(0).args[0]).to.contain('traffic_source_code=source');
});

});

0 comments on commit 3c2027a

Please sign in to comment.