From ed25bd7d20a567b88fcca68b42cbf1d9537818d2 Mon Sep 17 00:00:00 2001 From: hrath2015 Date: Fri, 26 May 2017 01:07:02 +0530 Subject: [PATCH] fix testing issue #2348 --- .../server/publications/searchresults.app-test.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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(); }); }); });