www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit fbd21bae1600ac6b338a80c08de76b9c0530d823
parent 60befe52e4fec76ff7cbe6c169510661d443a971
Author: Dan Stillman <dstillman@zotero.org>
Date:   Thu,  8 Dec 2016 05:52:22 -0500

Don't update feeds after syncs during tests

This reverts commit 60befe52e4fec76ff7cbe6c169510661d443a971 and adds a
better fix that leaves the notifier event in place. Feeds just don't
need to update after syncs during tests.

Diffstat:
Mchrome/content/zotero/xpcom/data/feeds.js | 2++
Mtest/tests/syncRunnerTest.js | 25+------------------------
2 files changed, 3 insertions(+), 24 deletions(-)

diff --git 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 @@ -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(); }