Don't update feeds after syncs during tests

This reverts commit 60befe52e4 and adds a
better fix that leaves the notifier event in place. Feeds just don't
need to update after syncs during tests.
This commit is contained in:
Dan Stillman 2016-12-08 05:52:22 -05:00
parent 60befe52e4
commit fbd21bae16
2 changed files with 3 additions and 24 deletions

View file

@ -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');

View file

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