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

Add trafficSourceCode + test #1184

Merged
merged 1 commit into from
May 8, 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
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');
});

});