Skip to content

Commit

Permalink
fix #2594: remove needless sandbox creation
Browse files Browse the repository at this point in the history
  • Loading branch information
fatso83 committed May 7, 2024
1 parent 16a25ae commit c618edc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
Expand Up @@ -16,14 +16,12 @@ const myExternalLibrary = {
};

describe("Wrap all object methods", function () {
const sandbox = sinon.createSandbox();

beforeEach(function () {
sandbox.spy(myExternalLibrary);
sinon.spy(myExternalLibrary);
});

afterEach(function () {
sandbox.restore();
sinon.restore();
});

it("should inspect the external lib's usage of its internal methods", function () {
Expand Down
Expand Up @@ -11,14 +11,12 @@ const jQuery = require("jquery")(window);
global.document = document;

describe("Wrap existing method", function () {
const sandbox = sinon.createSandbox();

beforeEach(function () {
sandbox.spy(jQuery, "ajax");
sinon.spy(jQuery, "ajax");
});

afterEach(function () {
sandbox.restore();
sinon.restore();
});

it("should inspect jQuery.getJSON's usage of jQuery.ajax", function () {
Expand Down
6 changes: 2 additions & 4 deletions docs/release-source/release/examples/spies-8-spy-call.test.js
Expand Up @@ -11,14 +11,12 @@ const jQuery = require("jquery")(window);
global.document = document;

describe("Return nth call", function () {
const sandbox = sinon.createSandbox();

beforeEach(function () {
sandbox.spy(jQuery, "ajax");
sinon.spy(jQuery, "ajax");
});

afterEach(function () {
sandbox.restore();
sinon.restore();
});

it("should inspect jQuery.getJSON's usage of jQuery.ajax", function () {
Expand Down

0 comments on commit c618edc

Please sign in to comment.