Skip to content

Commit

Permalink
Revert to Sinon 1 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewlane committed Sep 8, 2017
1 parent 8662fd9 commit a2854c8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
4 changes: 3 additions & 1 deletion test/spec/bidmanager_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ describe('bidmanager.js', function () {
});

it('requires a renderer on outstream bids', () => {
getSandbox().stub(utils, 'getBidRequest').callsFake(() => ({
sinon.stub(utils, 'getBidRequest', () => ({
bidder: 'appnexusAst',
mediaTypes: {
video: {context: 'outstream'}
Expand All @@ -618,6 +618,8 @@ 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();
});
});
});
19 changes: 12 additions & 7 deletions test/spec/video_spec.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import useSandbox from 'test/mocks/sandbox';
import { isValidVideoBid } from 'src/video';
const utils = require('src/utils');

describe('video.js', () => {
const getSandbox = useSandbox()

it('validates valid instream bids', () => {
getSandbox().stub(utils, 'getBidRequest').callsFake(() => ({
sinon.stub(utils, 'getBidRequest', () => ({
bidder: 'appnexusAst',
mediaTypes: {
video: { context: 'instream' },
Expand All @@ -18,10 +15,12 @@ describe('video.js', () => {
});

expect(valid).to.be(true);

utils.getBidRequest.restore();
});

it('catches invalid instream bids', () => {
getSandbox().stub(utils, 'getBidRequest').callsFake(() => ({
sinon.stub(utils, 'getBidRequest', () => ({
bidder: 'appnexusAst',
mediaTypes: {
video: { context: 'instream' },
Expand All @@ -31,10 +30,12 @@ describe('video.js', () => {
const valid = isValidVideoBid({});

expect(valid).to.be(false);

utils.getBidRequest.restore();
});

it('validates valid outstream bids', () => {
getSandbox().stub(utils, 'getBidRequest').callsFake(() => ({
sinon.stub(utils, 'getBidRequest', () => ({
bidder: 'appnexusAst',
mediaTypes: {
video: { context: 'outstream' },
Expand All @@ -49,10 +50,12 @@ describe('video.js', () => {
});

expect(valid).to.be(true);

utils.getBidRequest.restore();
});

it('catches invalid outstream bids', () => {
getSandbox().stub(utils, 'getBidRequest').callsFake(() => ({
sinon.stub(utils, 'getBidRequest', () => ({
bidder: 'appnexusAst',
mediaTypes: {
video: { context: 'outstream' },
Expand All @@ -62,5 +65,7 @@ describe('video.js', () => {
const valid = isValidVideoBid({});

expect(valid).to.be(false);

utils.getBidRequest.restore();
});
});

0 comments on commit a2854c8

Please sign in to comment.