From 02b4bef19d5d465092da454f0c1a7db52ee2cc38 Mon Sep 17 00:00:00 2001 From: Maximilian Antoni Date: Tue, 11 Dec 2018 16:05:57 +0100 Subject: [PATCH] Use the Sinon default sandbox --- lib/referee-sinon.test.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/lib/referee-sinon.test.js b/lib/referee-sinon.test.js index 0732bc1..1af845a 100644 --- a/lib/referee-sinon.test.js +++ b/lib/referee-sinon.test.js @@ -4,8 +4,6 @@ var sinon = require("sinon"); var referee = require("@sinonjs/referee"); var formatio = require("@sinonjs/formatio"); -var sandbox = sinon.createSandbox(); - var assert = referee.assert; var refute = referee.refute; var expect = referee.expect; @@ -35,7 +33,7 @@ function requiresSpy(assertion) { describe("referee-sinon", function () { afterEach(function () { - sandbox.restore(); + sinon.restore(); }); describe("sinon", function () { @@ -80,7 +78,7 @@ describe("referee-sinon", function () { describe("assertions", function () { it("formats assert messages through referee", function () { - sandbox.stub(referee, "format").returns("I'm the object"); + sinon.stub(referee, "format").returns("I'm the object"); var message; var spy = sinon.spy(); spy({ id: 42 }); @@ -122,7 +120,7 @@ describe("referee-sinon", function () { it("doesn't pass undefined to [].slice (IE8 doesn't like that)", function () { var spy = sinon.spy(); spy("foo"); - sandbox.spy(Array.prototype, "slice"); + sinon.spy(Array.prototype, "slice"); assert.calledWith(spy, "foo"); assert.calledWithExactly(Array.prototype.slice, 1); @@ -593,7 +591,7 @@ describe("referee-sinon", function () { it("fails when not called with spy", requiresSpy("threw")); it("passes when spy threw", function () { - var spy = sandbox.stub().throws(); + var spy = sinon.stub().throws(); try { spy(); // eslint-disable-next-line no-empty @@ -615,7 +613,7 @@ describe("referee-sinon", function () { }); it("works with spy calls", function () { - var spy = sandbox.stub().throws(); + var spy = sinon.stub().throws(); try { spy(); // eslint-disable-next-line no-empty @@ -628,7 +626,7 @@ describe("referee-sinon", function () { it("fails when not called with spy", requiresSpy("alwaysThrew")); it("passes when spy always threw", function () { - var spy = sandbox.stub().throws(); + var spy = sinon.stub().throws(); try { spy(); // eslint-disable-next-line no-empty @@ -698,7 +696,7 @@ describe("referee-sinon", function () { describe("expectations", function () { it("toHaveBeenCalledWithMatch", function () { - var stub = sandbox.stub(assert, "calledWithMatch"); + var stub = sinon.stub(assert, "calledWithMatch"); expect().toHaveBeenCalledWithMatch(); @@ -706,7 +704,7 @@ describe("referee-sinon", function () { }); it("toHaveAlwaysBeenCalledWithMatch", function () { - var stub = sandbox.stub(assert, "alwaysCalledWithMatch"); + var stub = sinon.stub(assert, "alwaysCalledWithMatch"); expect().toHaveAlwaysBeenCalledWithMatch(); @@ -716,7 +714,7 @@ describe("referee-sinon", function () { describe("sinon assert failures", function () { it("delegates to referee.assert.fail", function () { - sandbox.stub(referee, "fail"); + sinon.stub(referee, "fail"); try { assert.calledOnce(sinon.spy()); @@ -743,7 +741,7 @@ describe("referee-sinon", function () { describe("sinon mock expectation failures", function () { it("delegates to referee.assert.fail", function () { - sandbox.stub(referee, "fail"); + sinon.stub(referee, "fail"); try { sinon.mock().never()();