From a2d874c8bc9d0f1b8cc49460985e547200c57b59 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 20 Jun 2017 00:51:38 -0400 Subject: [PATCH] Don't schedule feed checks during tests Tests create lots of fake feeds with invalid URLs, so auto-updating would otherwise hang and block the explicit feed updates done by other tests. --- chrome/content/zotero/xpcom/data/feeds.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/xpcom/data/feeds.js b/chrome/content/zotero/xpcom/data/feeds.js index e81c33af5..f82658a28 100644 --- a/chrome/content/zotero/xpcom/data/feeds.js +++ b/chrome/content/zotero/xpcom/data/feeds.js @@ -32,9 +32,14 @@ Zotero.Feeds = new function() { this.init = function () { // Delay initialization for tests - _initPromise = Zotero.Schema.schemaUpdatePromise.delay(5000).then(() => { - this.scheduleNextFeedCheck().then(() => _initPromise = null); - }); + _initPromise = Zotero.Schema.schemaUpdatePromise.delay(5000) + .then(() => { + // Don't run feed checks randomly during tests + if (Zotero.test) return; + + return this.scheduleNextFeedCheck(); + }) + .then(() => _initPromise = null); Zotero.SyncedSettings.onSyncDownload.addListener(Zotero.Libraries.userLibraryID, 'feeds', (oldValue, newValue, conflict) => { @@ -52,7 +57,7 @@ Zotero.Feeds = new function() { if (_initPromise) { await _initPromise; } - Zotero.Feeds.updateFeeds(); + await Zotero.Feeds.updateFeeds(); } }, },