Skip to content

Commit

Permalink
move test to adaptermanager_spec
Browse files Browse the repository at this point in the history
  • Loading branch information
snapwich committed Oct 20, 2017
1 parent b539a1f commit 6cee170
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 18 deletions.
42 changes: 42 additions & 0 deletions test/spec/unit/core/adapterManager_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,48 @@ var appnexusAdapterMock = {
};

describe('adapterManager tests', () => {
describe('callBids', () => {
beforeEach(() => {
sinon.stub(utils, 'logError');
});

afterEach(() => {
utils.logError.restore();
});

it('should log an error if a bidder is used that does not exist', () => {
const adUnits = [{
code: 'adUnit-code',
bids: [
{bidder: 'appnexus', params: {placementId: 'id'}},
{bidder: 'fakeBidder', params: {placementId: 'id'}}
]
}];

AdapterManager.callBids({adUnits});

sinon.assert.called(utils.logError);
});
});

it('should log an error if a bidder is used that does not exist', () => {
sinon.stub(utils, 'logError');

const adUnits = [{
code: 'adUnit-code',
bids: [
{bidder: 'appnexus', params: {placementId: 'id'}},
{bidder: 'fakeBidder', params: {placementId: 'id'}}
]
}];

$$PREBID_GLOBAL$$.requestBids({adUnits});

sinon.assert.called(utils.logError);

utils.logError.restore();
});

describe('S2S tests', () => {
beforeEach(() => {
AdapterManager.setS2SConfig(CONFIG);
Expand Down
18 changes: 0 additions & 18 deletions test/spec/unit/pbjs_api_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -779,24 +779,6 @@ describe('Unit: Prebid Module', function () {
adaptermanager.callBids.restore();
});

it('should log an error if a bidder is used that does not exist', () => {
sinon.stub(utils, 'logError');

const adUnits = [{
code: 'adUnit-code',
bids: [
{bidder: 'appnexus', params: {placementId: 'id'}},
{bidder: 'fakeBidder', params: {placementId: 'id'}}
]
}];

$$PREBID_GLOBAL$$.requestBids({adUnits});

sinon.assert.called(utils.logError);

utils.logError.restore();
});

it('should not callBids if a video adUnit has non-video bidders', () => {
sinon.spy(adaptermanager, 'callBids');
const videoAdaptersBackup = adaptermanager.videoAdapters;
Expand Down

0 comments on commit 6cee170

Please sign in to comment.