diff --git a/package.json b/package.json
index 78ed90c6880..98fe2b3f0cd 100644
--- a/package.json
+++ b/package.json
@@ -92,7 +92,7 @@
"proxyquire": "^1.7.10",
"querystringify": "0.0.3",
"requirejs": "^2.1.20",
- "sinon": "^3.2.0",
+ "sinon": "^1.12.1",
"string-replace-webpack-plugin": "^0.1.3",
"through2": "^2.0.3",
"uglify-js": "^2.8.10",
diff --git a/test/mocks/sandbox.js b/test/mocks/sandbox.js
deleted file mode 100644
index 52aefd7b93e..00000000000
--- a/test/mocks/sandbox.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import sinon from 'sinon';
-
-/**
- * Function which can be called from inside a describe() block to make sure that each test runs in a sandbox.
- *
- * @return {function} A function which can be called from it() blocks to return the current sandbox.
- */
-export default function useSandbox() {
- let sandbox;
-
- beforeEach(() => {
- sandbox = sinon.sandbox.create();
- });
-
- afterEach(() => {
- sandbox.restore();
- });
-
- return function() {
- return sandbox;
- }
-}
diff --git a/test/mocks/videoCacheStub.js b/test/mocks/videoCacheStub.js
index 5ec1cb205b1..4a1d8bca343 100644
--- a/test/mocks/videoCacheStub.js
+++ b/test/mocks/videoCacheStub.js
@@ -1,4 +1,3 @@
-import sinon from 'sinon';
import * as videoCache from 'src/videoCache';
/**
diff --git a/test/spec/AnalyticsAdapter_spec.js b/test/spec/AnalyticsAdapter_spec.js
index b3f9f2346ea..3eeb5a9efee 100644
--- a/test/spec/AnalyticsAdapter_spec.js
+++ b/test/spec/AnalyticsAdapter_spec.js
@@ -69,7 +69,7 @@ FEATURE: Analytics Adapters API
adapter = new AnalyticsAdapter(config);
spyTestGlobal = sinon.spy(window, config.global);
- sinon.stub(events, 'getEvents').returns([]); // these tests shouldn't be affected by previous tests
+ sinon.stub(events, 'getEvents', () => []); // these tests shouldn't be affected by previous tests
});
afterEach(() => {
@@ -139,7 +139,7 @@ FEATURE: Analytics Adapters API
const args = { more: 'info' };
beforeEach(() => {
- sinon.stub(Math, 'random').returns(0.5);
+ sinon.stub(Math, 'random', () => 0.5);
});
afterEach(() => {
diff --git a/test/spec/bidmanager_spec.js b/test/spec/bidmanager_spec.js
index 25d5d2ad354..150163aa43b 100644
--- a/test/spec/bidmanager_spec.js
+++ b/test/spec/bidmanager_spec.js
@@ -1,9 +1,12 @@
-import useSandbox from 'test/mocks/sandbox';
-import * as utils from 'src/utils';
-import * as bidmanager from 'src/bidmanager';
-import * as bidfactory from 'src/bidfactory';
-import * as fixtures from 'test/fixtures/fixtures';
-import * as assert from 'assert';
+var assert = require('assert');
+
+/* use this method to test individual files instead of the whole prebid.js project */
+
+// TODO refactor to use the spec files
+var utils = require('../../src/utils');
+var bidmanager = require('../../src/bidmanager');
+var bidfactory = require('../../src/bidfactory');
+var fixtures = require('../fixtures/fixtures');
describe('replaceTokenInString', function () {
it('should replace all given tokens in a String', function () {
@@ -414,9 +417,6 @@ describe('bidmanager.js', function () {
before(() => {
$$PREBID_GLOBAL$$.adUnits = fixtures.getAdUnits();
});
-
- const getSandbox = useSandbox()
-
it('should return proper price bucket increments for dense mode', () => {
const bid = Object.assign({},
bidfactory.createBid(2),
@@ -501,13 +501,11 @@ describe('bidmanager.js', function () {
});
it('should add banner bids that have no width or height but single adunit size', () => {
- getSandbox().stub(utils, 'getBidderRequest').callsFake(() => {
- return {
- bids: [{
- sizes: [[300, 250]],
- }]
- }
- });
+ sinon.stub(utils, 'getBidderRequest', () => ({
+ bids: [{
+ sizes: [[300, 250]],
+ }]
+ }));
const bid = Object.assign({},
bidfactory.createBid(1),
@@ -524,18 +522,18 @@ describe('bidmanager.js', function () {
assert.equal(bid.adId, addedBid.adId);
assert.equal(addedBid.width, 300);
assert.equal(addedBid.height, 250);
+
+ utils.getBidderRequest.restore();
});
it('should not add native bids that do not have required assets', () => {
- getSandbox().stub(utils, 'getBidRequest').callsFake(() => {
- return {
- bidder: 'appnexusAst',
- nativeParams: {
- title: {'required': true},
- },
- mediaType: 'native',
- }
- });
+ sinon.stub(utils, 'getBidRequest', () => ({
+ bidder: 'appnexusAst',
+ nativeParams: {
+ title: {'required': true},
+ },
+ mediaType: 'native',
+ }));
const bid = Object.assign({},
bidfactory.createBid(1),
@@ -549,18 +547,18 @@ describe('bidmanager.js', function () {
const bidsRecCount = $$PREBID_GLOBAL$$._bidsReceived.length;
bidmanager.addBidResponse('adUnit-code', bid);
assert.equal(bidsRecCount, $$PREBID_GLOBAL$$._bidsReceived.length);
+
+ utils.getBidRequest.restore();
});
it('should add native bids that do have required assets', () => {
- getSandbox().stub(utils, 'getBidRequest').callsFake(() => {
- return {
- bidder: 'appnexusAst',
- nativeParams: {
- title: {'required': true},
- },
- mediaType: 'native',
- }
- });
+ sinon.stub(utils, 'getBidRequest', () => ({
+ bidder: 'appnexusAst',
+ nativeParams: {
+ title: {'required': true},
+ },
+ mediaType: 'native',
+ }));
const bid = Object.assign({},
bidfactory.createBid(1),
@@ -574,19 +572,19 @@ describe('bidmanager.js', function () {
const bidsRecCount = $$PREBID_GLOBAL$$._bidsReceived.length;
bidmanager.addBidResponse('adUnit-code', bid);
assert.equal(bidsRecCount + 1, $$PREBID_GLOBAL$$._bidsReceived.length);
+
+ utils.getBidRequest.restore();
});
it('installs publisher-defined renderers on bids', () => {
- getSandbox().stub(utils, 'getBidderRequest').callsFake(() => {
- return {
- bids: [{
- renderer: {
- url: 'renderer.js',
- render: (bid) => bid
- }
- }]
- };
- });
+ sinon.stub(utils, 'getBidderRequest', () => ({
+ bids: [{
+ renderer: {
+ url: 'renderer.js',
+ render: (bid) => bid
+ }
+ }]
+ }));
const bid = Object.assign({}, bidfactory.createBid(1), {
bidderCode: 'appnexusAst',
@@ -596,6 +594,8 @@ describe('bidmanager.js', function () {
bidmanager.addBidResponse('adUnit-code', bid);
const addedBid = $$PREBID_GLOBAL$$._bidsReceived.pop();
assert.equal(addedBid.renderer.url, 'renderer.js');
+
+ utils.getBidderRequest.restore();
});
});
});
diff --git a/test/spec/modules/adkernelBidAdapter_spec.js b/test/spec/modules/adkernelBidAdapter_spec.js
index 703981fa5a8..5fabbad7fbf 100644
--- a/test/spec/modules/adkernelBidAdapter_spec.js
+++ b/test/spec/modules/adkernelBidAdapter_spec.js
@@ -146,12 +146,14 @@ describe('Adkernel adapter', () => {
let bidRequest;
beforeEach(() => {
- sandbox.stub(utils, 'getTopWindowLocation').returns({
- protocol: 'https:',
- hostname: 'example.com',
- host: 'example.com',
- pathname: '/index.html',
- href: 'http://example.com/index.html'
+ sandbox.stub(utils, 'getTopWindowLocation', () => {
+ return {
+ protocol: 'https:',
+ hostname: 'example.com',
+ host: 'example.com',
+ pathname: '/index.html',
+ href: 'http://example.com/index.html'
+ };
});
ajaxStub.onCall(0).callsArgWith(1, JSON.stringify(bidResponse1));
@@ -196,12 +198,14 @@ describe('Adkernel adapter', () => {
let bidRequest;
beforeEach(() => {
- sandbox.stub(utils, 'getTopWindowLocation').returns({
- protocol: 'https:',
- hostname: 'example.com',
- host: 'example.com',
- pathname: '/index.html',
- href: 'http://example.com/index.html'
+ sandbox.stub(utils, 'getTopWindowLocation', () => {
+ return {
+ protocol: 'https:',
+ hostname: 'example.com',
+ host: 'example.com',
+ pathname: '/index.html',
+ href: 'http://example.com/index.html'
+ };
});
ajaxStub.onCall(0).callsArgWith(1, JSON.stringify(videoBidResponse));
doRequest([bid_video]);
@@ -320,8 +324,10 @@ describe('Adkernel adapter', () => {
'//sync.adkernel.com/user-sync?zone=2&r=%2F%2Frtb.adkernel.com%2Fuser-synced%3Fuid%3D%7BUID%7D',
'//sync.adkernel.com/user-sync?zone=1&r=%2F%2Frtb.adkernel.com%2Fuser-synced%3Fuid%3D%7BUID%7D'];
let userSyncUrls = [];
- sandbox.stub(utils, 'createInvisibleIframe').returns({});
- sandbox.stub(utils, 'addEventHandler').callsFake((el, ev, cb) => {
+ sandbox.stub(utils, 'createInvisibleIframe', () => {
+ return {};
+ });
+ sandbox.stub(utils, 'addEventHandler', (el, ev, cb) => {
userSyncUrls.push(el.src);
cb(); // instant callback
});
diff --git a/test/spec/modules/admixerBidAdapter_spec.js b/test/spec/modules/admixerBidAdapter_spec.js
index c2a38df02c3..0b66f8a9469 100644
--- a/test/spec/modules/admixerBidAdapter_spec.js
+++ b/test/spec/modules/admixerBidAdapter_spec.js
@@ -1,5 +1,3 @@
-import useSandbox from 'test/mocks/sandbox';
-
var chai = require('chai');
var Adapter = require('modules/admixerBidAdapter')();
var Ajax = require('src/ajax');
@@ -135,107 +133,108 @@ describe('Admixer adapter', function () {
var validJsonVideoParams = {
zone: 'zone_id',
callback_uid: 'ad-unit-1',
- sizes: '300x250',
+ sizes: '300x250-300x600',
+ skippable: true
};
-
- const getSandbox = useSandbox();
-
describe('bid request with valid data', function () {
+ var stubAjax;
+ beforeEach(function () {
+ stubAjax = sinon.stub(Ajax, 'ajax');
+ });
+
+ afterEach(function () {
+ stubAjax.restore();
+ });
it('display: bid request should be called. sizes style -> [[],[]]', function () {
- const stubAjax = getSandbox().stub(Ajax, 'ajax');
Adapter.callBids(validData_1);
sinon.assert.calledOnce(stubAjax);
});
it('video: bid request should be called. sizes style -> [[],[]]', function () {
- const stubAjax = getSandbox().stub(Ajax, 'ajax');
Adapter.callBids(validVideoData_1);
sinon.assert.calledOnce(stubAjax);
});
it('display: bid request should be called. sizes style -> []', function () {
- const stubAjax = getSandbox().stub(Ajax, 'ajax');
Adapter.callBids(validData_2);
sinon.assert.calledOnce(stubAjax);
});
it('video: bid request should be called. sizes style -> []', function () {
- const stubAjax = getSandbox().stub(Ajax, 'ajax');
Adapter.callBids(validVideoData_2);
sinon.assert.calledOnce(stubAjax);
});
- // These tests began failing with the sinon 1.x -> 3.x upgrade. Unfortunately,
- // they're not using a sinon 1.x API legally... so it's unclear exactly what
- // they're supposed to be testing.
- // it('display: ajax params should be matched', function () {
- // const stubAjax = getSandbox().stub(Ajax, 'ajax');
- // Adapter.callBids(validData_1);
- // sinon.assert.calledWith(stubAjax, sinon.match(invUrl, function () {
- // }, validJsonParams, {method: 'GET'}));
- // });
- // it('video: ajax params should be matched', function () {
- // const stubAjax = getSandbox().stub(Ajax, 'ajax');
- // Adapter.callBids(validVideoData_3);
- // sinon.assert.calledWith(stubAjax, sinon.match(invVastUrl, function () {
- // }, validJsonVideoParams, {method: 'GET'}));
- // });
+ it('display: ajax params should be matched', function () {
+ Adapter.callBids(validData_1);
+ sinon.assert.calledWith(stubAjax, sinon.match(invUrl, function () {
+ }, validJsonParams, {method: 'GET'}));
+ });
+ it('video: ajax params should be matched', function () {
+ Adapter.callBids(validVideoData_3);
+ sinon.assert.calledWith(stubAjax, sinon.match(invVastUrl, function () {
+ }, validJsonVideoParams, {method: 'GET'}));
+ });
});
describe('bid request with invalid data', function () {
+ var addBidResponse, stubAjax;
+ beforeEach(function () {
+ addBidResponse = sinon.stub(bidmanager, 'addBidResponse');
+ stubAjax = sinon.stub(Ajax, 'ajax');
+ });
+
+ afterEach(function () {
+ addBidResponse.restore();
+ stubAjax.restore();
+ });
it('display: ajax shouldn\'t be called', function () {
- const addBidResponse = getSandbox().stub(bidmanager, 'addBidResponse');
- const stubAjax = getSandbox().stub(Ajax, 'ajax');
Adapter.callBids(invalidData);
sinon.assert.notCalled(stubAjax);
});
it('video: ajax shouldn\'t be called', function () {
- const addBidResponse = getSandbox().stub(bidmanager, 'addBidResponse');
- const stubAjax = getSandbox().stub(Ajax, 'ajax');
Adapter.callBids(invalidVideoData);
sinon.assert.notCalled(stubAjax);
});
it('display: bidmanager.addBidResponse status code must to be equal "' + CONSTANTS.STATUS.NO_BID + '"', function () {
- const addBidResponse = getSandbox().stub(bidmanager, 'addBidResponse');
- getSandbox().stub(Ajax, 'ajax');
Adapter.callBids(invalidData);
expect(addBidResponse.firstCall.args[1].getStatusCode()).to.equal(CONSTANTS.STATUS.NO_BID);
expect(addBidResponse.firstCall.args[1].bidderCode).to.equal('admixer');
});
it('video: bidmanager.addBidResponse status code must to be equal "' + CONSTANTS.STATUS.NO_BID + '"', function () {
- const addBidResponse = getSandbox().stub(bidmanager, 'addBidResponse');
- getSandbox().stub(Ajax, 'ajax');
Adapter.callBids(invalidVideoData);
expect(addBidResponse.firstCall.args[1].getStatusCode()).to.equal(CONSTANTS.STATUS.NO_BID);
expect(addBidResponse.firstCall.args[1].bidderCode).to.equal('admixer');
});
});
describe('bid response', function () {
+ var addBidResponse;
+ beforeEach(function () {
+ addBidResponse = sinon.stub(bidmanager, 'addBidResponse');
+ });
+ afterEach(function () {
+ addBidResponse.restore();
+ });
it('display: response with ad. bidmanager.addBidResponse status code must to be equal "' + CONSTANTS.STATUS.GOOD + '"', function () {
- const addBidResponse = getSandbox().stub(bidmanager, 'addBidResponse');
Adapter.responseCallback(responseWithAd);
var arg = addBidResponse.firstCall.args[1];
expect(arg.getStatusCode()).to.equal(CONSTANTS.STATUS.GOOD);
expect(arg.bidderCode).to.equal('admixer');
});
it('video: response with ad. bidmanager.addBidResponse status code must to be equal "' + CONSTANTS.STATUS.GOOD + '"', function () {
- const addBidResponse = getSandbox().stub(bidmanager, 'addBidResponse');
Adapter.responseCallback(responseWithVideoAd);
var arg = addBidResponse.firstCall.args[1];
expect(arg.getStatusCode()).to.equal(CONSTANTS.STATUS.GOOD);
expect(arg.bidderCode).to.equal('admixer');
});
it('display: response without ad. bidmanager.addBidResponse status code must to be equal "' + CONSTANTS.STATUS.NO_BID, function () {
- const addBidResponse = getSandbox().stub(bidmanager, 'addBidResponse');
Adapter.responseCallback(responseWithoutAd);
var arg = addBidResponse.firstCall.args[1];
expect(arg.getStatusCode()).to.equal(CONSTANTS.STATUS.NO_BID);
expect(arg.bidderCode).to.equal('admixer');
});
it('video: response without ad. bidmanager.addBidResponse status code must to be equal "' + CONSTANTS.STATUS.NO_BID, function () {
- const addBidResponse = getSandbox().stub(bidmanager, 'addBidResponse');
Adapter.responseCallback(responseWithoutVideoAd);
var arg = addBidResponse.firstCall.args[1];
expect(arg.getStatusCode()).to.equal(CONSTANTS.STATUS.NO_BID);
expect(arg.bidderCode).to.equal('admixer');
});
it('display/video: response empty. bidmanager.addBidResponse status code must to be equal "' + CONSTANTS.STATUS.NO_BID, function () {
- const addBidResponse = getSandbox().stub(bidmanager, 'addBidResponse');
Adapter.responseCallback(responseEmpty);
var arg = addBidResponse.firstCall.args[1];
expect(arg.getStatusCode()).to.equal(CONSTANTS.STATUS.NO_BID);
diff --git a/test/spec/modules/atomxBidAdapter_spec.js b/test/spec/modules/atomxBidAdapter_spec.js
index 2c2d63d3688..646061912e7 100644
--- a/test/spec/modules/atomxBidAdapter_spec.js
+++ b/test/spec/modules/atomxBidAdapter_spec.js
@@ -1,5 +1,3 @@
-import useSandbox from 'test/mocks/sandbox';
-
var chai = require('chai');
var Adapter = require('modules/atomxBidAdapter')();
var Ajax = require('src/ajax');
@@ -65,10 +63,8 @@ describe('Atomx adapter', function () {
size: '300x250'
};
- const getSandbox = useSandbox();
-
- it('loads the tag code', function() {
- var stubLoadScript = getSandbox().stub(adLoader, 'loadScript');
+ describe('loads the tag code', function() {
+ var stubLoadScript = sinon.stub(adLoader, 'loadScript');
Adapter.callBids(validData_1);
sinon.assert.calledOnce(stubLoadScript);
let url = stubLoadScript.firstCall.args[0];
@@ -77,68 +73,74 @@ describe('Atomx adapter', function () {
expect(callback).to.be.a('function');
});
describe('bid request with valid data', function () {
+ var stubAjax;
beforeEach(function () {
window.atomx_prebid = function() {
return '/placement';
};
+ stubAjax = sinon.stub(Ajax, 'ajax');
+ });
+ afterEach(function () {
+ stubAjax.restore();
});
it('bid request should be called. sizes style -> [[],[]]', function () {
- const stubAjax = getSandbox().stub(Ajax, 'ajax');
Adapter.callBids(validData_1);
sinon.assert.calledTwice(stubAjax);
});
- // These tests began failing with the sinon 1.x -> 3.x upgrade. Unfortunately,
- // they're not using a sinon 1.x API legally... so it's unclear exactly what
- // they're supposed to be testing.
- // it('bid request should be called. sizes style -> []', function () {
- // const stubAjax = getSandbox().stub(Ajax, 'ajax');
- // Adapter.callBids(validData_2);
- // sinon.assert.calledOnce(stubAjax);
- // });
- // it('ajax params should be matched', function () {
- // const stubAjax = getSandbox().stub(Ajax, 'ajax');
- // Adapter.callBids(validData_1);
- // sinon.assert.calledWith(stubAjax, sinon.match('/placement', function () {
- // }, validJsonParams, {method: 'GET'}));
- // });
+ it('bid request should be called. sizes style -> []', function () {
+ Adapter.callBids(validData_2);
+ sinon.assert.calledOnce(stubAjax);
+ });
+ it('ajax params should be matched', function () {
+ Adapter.callBids(validData_1);
+ sinon.assert.calledWith(stubAjax, sinon.match('/placement', function () {
+ }, validJsonParams, {method: 'GET'}));
+ });
});
describe('bid request with invalid data', function () {
+ var addBidResponse, stubAjax;
beforeEach(function () {
window.atomx_prebid = function() {
return '/placement';
};
+ addBidResponse = sinon.stub(bidmanager, 'addBidResponse');
+ stubAjax = sinon.stub(Ajax, 'ajax');
+ });
+ afterEach(function () {
+ addBidResponse.restore();
+ stubAjax.restore();
});
it('ajax shouldn\'t be called', function () {
- const stubAjax = getSandbox().stub(Ajax, 'ajax');
- getSandbox().stub(bidmanager, 'addBidResponse');
Adapter.callBids(invalidData);
sinon.assert.notCalled(stubAjax);
});
it('bidmanager.addBidResponse status code must to be equal "' + CONSTANTS.STATUS.NO_BID + '"', function () {
- getSandbox().stub(Ajax, 'ajax');
- const addBidResponse = getSandbox().stub(bidmanager, 'addBidResponse');
Adapter.callBids(invalidData);
expect(addBidResponse.firstCall.args[1].getStatusCode()).to.equal(CONSTANTS.STATUS.NO_BID);
expect(addBidResponse.firstCall.args[1].bidderCode).to.equal('atomx');
});
});
describe('bid response', function () {
+ var addBidResponse;
+ beforeEach(function () {
+ addBidResponse = sinon.stub(bidmanager, 'addBidResponse');
+ });
+ afterEach(function () {
+ addBidResponse.restore();
+ });
it('with ad. bidmanager.addBidResponse status code must to be equal "' + CONSTANTS.STATUS.GOOD + '"', function () {
- const addBidResponse = getSandbox().stub(bidmanager, 'addBidResponse');
Adapter.responseCallback(validData_1.bids[0], responseWithAd);
var arg = addBidResponse.firstCall.args[1];
expect(arg.getStatusCode()).to.equal(CONSTANTS.STATUS.GOOD);
expect(arg.bidderCode).to.equal('atomx');
});
it('without ad. bidmanager.addBidResponse status code must to be equal "' + CONSTANTS.STATUS.NO_BID, function () {
- const addBidResponse = getSandbox().stub(bidmanager, 'addBidResponse');
Adapter.responseCallback(validData_1.bids[0], responseWithoutAd);
var arg = addBidResponse.firstCall.args[1];
expect(arg.getStatusCode()).to.equal(CONSTANTS.STATUS.NO_BID);
expect(arg.bidderCode).to.equal('atomx');
});
it('empty. bidmanager.addBidResponse status code must to be equal "' + CONSTANTS.STATUS.NO_BID, function () {
- const addBidResponse = getSandbox().stub(bidmanager, 'addBidResponse');
Adapter.responseCallback(validData_1.bids[0], responseEmpty);
var arg = addBidResponse.firstCall.args[1];
expect(arg.getStatusCode()).to.equal(CONSTANTS.STATUS.NO_BID);
diff --git a/test/spec/modules/coxBidAdapter_spec.js b/test/spec/modules/coxBidAdapter_spec.js
index ea5e39b78cd..ee1eb991f23 100644
--- a/test/spec/modules/coxBidAdapter_spec.js
+++ b/test/spec/modules/coxBidAdapter_spec.js
@@ -42,7 +42,7 @@ describe('CoxAdapter', () => {
// ===== 1
it('should provide a correctly populated Bid given a valid response', () => {
- loadScriptStub = sinon.stub(adLoader, 'loadScript').callsFake(() => { emitScript(normalResponse); })
+ loadScriptStub = sinon.stub(adLoader, 'loadScript', () => { emitScript(normalResponse); })
adapter.callBids(oneBidConfig);
@@ -54,7 +54,7 @@ describe('CoxAdapter', () => {
// ===== 2
it('should provide an empty Bid given a zero-price response', () => {
- loadScriptStub = sinon.stub(adLoader, 'loadScript').callsFake(() => { emitScript(zeroPriceResponse); })
+ loadScriptStub = sinon.stub(adLoader, 'loadScript', () => { emitScript(zeroPriceResponse); })
adapter.callBids(oneBidConfig);
@@ -65,7 +65,7 @@ describe('CoxAdapter', () => {
// ===== 3
it('should provide an empty Bid given an incomplete response', () => {
- loadScriptStub = sinon.stub(adLoader, 'loadScript').callsFake(() => { emitScript(incompleteResponse); })
+ loadScriptStub = sinon.stub(adLoader, 'loadScript', () => { emitScript(incompleteResponse); })
adapter.callBids(oneBidConfig);
@@ -76,7 +76,7 @@ describe('CoxAdapter', () => {
// ===== 4
it('should not provide a Bid given no response', () => {
- loadScriptStub = sinon.stub(adLoader, 'loadScript').callsFake(() => { emitScript(''); });
+ loadScriptStub = sinon.stub(adLoader, 'loadScript', () => { emitScript(''); });
adapter.callBids(oneBidConfig);
diff --git a/test/spec/modules/criteoBidAdapter_spec.js b/test/spec/modules/criteoBidAdapter_spec.js
index cd5255b141c..c8a49283c7a 100644
--- a/test/spec/modules/criteoBidAdapter_spec.js
+++ b/test/spec/modules/criteoBidAdapter_spec.js
@@ -132,7 +132,7 @@ describe('criteo adapter test', () => {
});
it('adds bid for valid request', (done) => {
- stubAddBidResponse = sinon.stub(bidManager, 'addBidResponse').callsFake(function (adUnitCode, bid) {
+ stubAddBidResponse = sinon.stub(bidManager, 'addBidResponse', function (adUnitCode, bid) {
expect(bid).to.satisfy(bid => { return bid.getStatusCode() == CONSTANTS.STATUS.GOOD });
done();
});
@@ -142,7 +142,7 @@ describe('criteo adapter test', () => {
it('adds bid for multibid valid request', (done) => {
let callCount = 0;
- stubAddBidResponse = sinon.stub(bidManager, 'addBidResponse').callsFake(function (adUnitCode, bid) {
+ stubAddBidResponse = sinon.stub(bidManager, 'addBidResponse', function (adUnitCode, bid) {
callCount++;
if (callCount == 2) { done(); }
@@ -152,7 +152,7 @@ describe('criteo adapter test', () => {
});
it('adds bidderCode to the response of a valid request', (done) => {
- stubAddBidResponse = sinon.stub(bidManager, 'addBidResponse').callsFake(function (adUnitCode, bid) {
+ stubAddBidResponse = sinon.stub(bidManager, 'addBidResponse', function (adUnitCode, bid) {
expect(bid).to.have.property('bidderCode', 'criteo');
done();
});
@@ -161,7 +161,7 @@ describe('criteo adapter test', () => {
});
it('adds cpm to the response of a valid request', (done) => {
- stubAddBidResponse = sinon.stub(bidManager, 'addBidResponse').callsFake(function (adUnitCode, bid) {
+ stubAddBidResponse = sinon.stub(bidManager, 'addBidResponse', function (adUnitCode, bid) {
expect(bid).to.have.property('cpm', 1.12);
done();
});
@@ -169,7 +169,7 @@ describe('criteo adapter test', () => {
});
it('adds creative to the response of a valid request', (done) => {
- stubAddBidResponse = sinon.stub(bidManager, 'addBidResponse').callsFake(function (adUnitCode, bid) {
+ stubAddBidResponse = sinon.stub(bidManager, 'addBidResponse', function (adUnitCode, bid) {
expect(bid).to.have.property('ad', "");
done();
});
@@ -187,7 +187,7 @@ describe('criteo adapter test', () => {
it('adds creative to the response of a native valid request', (done) => {
stubAddBidResponse = sinon.stub(
- bidManager, 'addBidResponse').callsFake(
+ bidManager, 'addBidResponse',
function (adUnitCode, bid) {
let expectedAdProperty = `