-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improvement/rad 1689 s2s drop empty bid (#1330)
* fix sending empty bids + tests * add unit tests * Include `src` on bidRequest object.
- Loading branch information
Matt Kendall
authored
Jun 30, 2017
1 parent
d0b73f4
commit 27fe1c2
Showing
4 changed files
with
70 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { expect } from 'chai'; | ||
import AdapterManager from 'src/adaptermanager'; | ||
import { getAdUnits } from 'test/fixtures/fixtures'; | ||
import CONSTANTS from 'src/constants.json'; | ||
|
||
const CONFIG = { | ||
enabled: true, | ||
endpoint: CONSTANTS.S2S.DEFAULT_ENDPOINT, | ||
timeout: 1000, | ||
maxBids: 1, | ||
adapter: 'prebidServer', | ||
bidders: ['appnexus'] | ||
}; | ||
var prebidServerAdapterMock = { | ||
bidder: 'prebidServer', | ||
callBids: sinon.stub(), | ||
setConfig: sinon.stub() | ||
}; | ||
|
||
describe('adapterManager tests', () => { | ||
describe('S2S tests', () => { | ||
beforeEach(() => { | ||
AdapterManager.setS2SConfig(CONFIG); | ||
AdapterManager.bidderRegistry['prebidServer'] = prebidServerAdapterMock; | ||
prebidServerAdapterMock.callBids.reset(); | ||
}); | ||
|
||
it('invokes callBids on the S2S adapter', () => { | ||
AdapterManager.callBids({adUnits: getAdUnits()}); | ||
sinon.assert.calledOnce(prebidServerAdapterMock.callBids); | ||
}); | ||
|
||
it('invokes callBids with only s2s bids', () => { | ||
const adUnits = getAdUnits(); | ||
// adUnit without appnexus bidder | ||
adUnits.push({ | ||
'code': '123', | ||
'sizes': [300, 250], | ||
'bids': [ | ||
{ | ||
'bidder': 'adequant', | ||
'params': { | ||
'publisher_id': '1234567', | ||
'bidfloor': 0.01 | ||
} | ||
} | ||
] | ||
}); | ||
AdapterManager.callBids({adUnits: adUnits}); | ||
const requestObj = prebidServerAdapterMock.callBids.firstCall.args[0]; | ||
expect(requestObj.ad_units.length).to.equal(2); | ||
sinon.assert.calledOnce(prebidServerAdapterMock.callBids); | ||
}); | ||
}); // end s2s tests | ||
}); |