diff --git a/chrome/content/zotero/xpcom/data/feeds.js b/chrome/content/zotero/xpcom/data/feeds.js index d79996aa6..19780edae 100644 --- a/chrome/content/zotero/xpcom/data/feeds.js +++ b/chrome/content/zotero/xpcom/data/feeds.js @@ -44,6 +44,8 @@ Zotero.Feeds = new function() { Zotero.Notifier.registerObserver({notify: function(event) { if (event == 'finish') { + // Don't update during tests, since the database will have been closed + if (Zotero.test) return; Zotero.Feeds.updateFeeds(); } }}, ['sync'], 'feedsUpdate'); diff --git a/test/tests/syncRunnerTest.js b/test/tests/syncRunnerTest.js index 36f06a0bf..1470bb3d6 100644 --- a/test/tests/syncRunnerTest.js +++ b/test/tests/syncRunnerTest.js @@ -556,18 +556,6 @@ describe("Zotero.Sync.Runner", function () { }) describe("#sync()", function () { - // Notifier is triggered without waiting for async actions to finish, which - // fires off database queries after its been closed. - var observerTriggerDeferred; - beforeEach(function() { - observerTriggerDeferred = Zotero.Promise.defer(); - sinon.stub(Zotero.Notifier, 'trigger', - (e) => {if (e == 'finish') observerTriggerDeferred.resolve(); return Zotero.Promise.resolve()}); - }); - afterEach(function* () { - yield observerTriggerDeferred.promise; - Zotero.Notifier.trigger.restore(); - }); it("should perform a sync across all libraries and update library versions", function* () { setResponse('keyInfo.fullAccess'); setResponse('userGroups.groupVersions'); @@ -958,18 +946,7 @@ describe("Zotero.Sync.Runner", function () { describe("Error Handling", function () { var win; - // Notifier is triggered without waiting for async actions to finish, which - // fires off database queries after its been closed. - var observerTriggerDeferred; - beforeEach(function() { - observerTriggerDeferred = Zotero.Promise.defer(); - sinon.stub(Zotero.Notifier, 'trigger', - (e) => {if (e == 'finish') observerTriggerDeferred.resolve(); return Zotero.Promise.resolve()}); - }); - - afterEach(function* () { - yield observerTriggerDeferred.promise; - Zotero.Notifier.trigger.restore(); + afterEach(function () { if (win) { win.close(); }