diff --git a/imports/plugins/included/search-mongo/server/publications/searchresults.app-test.js b/imports/plugins/included/search-mongo/server/publications/searchresults.app-test.js index 9eec73f2c26..6e2db55d454 100644 --- a/imports/plugins/included/search-mongo/server/publications/searchresults.app-test.js +++ b/imports/plugins/included/search-mongo/server/publications/searchresults.app-test.js @@ -114,31 +114,35 @@ describe("Search results", function () { describe("Account Search results", function () { let account; + let sandbox; before(function () { buildAccountSearch(); }); beforeEach(function () { + sandbox = sinon.sandbox.create(); account = createAccount(); buildAccountSearchRecord(account._id); }); + afterEach(function () { + sandbox.restore(); + }); + describe("account search", function () { it("should match accounts when searching by email", function () { - const roleStub = sinon.stub(Reaction, "hasPermission", () => true); + sandbox.stub(Reaction, "hasPermission", () => true); const email = account.emails[0].address; const results = getResults.accounts(email); expect(results.count()).to.equal(1); - roleStub.restore(); }); it("should not return results if not an admin", function () { - const roleStub = sinon.stub(Reaction, "hasPermission", () => false); + sandbox.stub(Reaction, "hasPermission", () => false); const email = account.emails[0].address; const results = getResults.accounts(email); expect(results).to.be.undefined; - roleStub.restore(); }); }); });