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.
This commit is contained in:
Dan Stillman 2017-06-20 00:51:38 -04:00
parent c11f1069d7
commit a2d874c8bc

View File

@ -32,9 +32,14 @@ Zotero.Feeds = new function() {
this.init = function () { this.init = function () {
// Delay initialization for tests // Delay initialization for tests
_initPromise = Zotero.Schema.schemaUpdatePromise.delay(5000).then(() => { _initPromise = Zotero.Schema.schemaUpdatePromise.delay(5000)
this.scheduleNextFeedCheck().then(() => _initPromise = null); .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', Zotero.SyncedSettings.onSyncDownload.addListener(Zotero.Libraries.userLibraryID, 'feeds',
(oldValue, newValue, conflict) => { (oldValue, newValue, conflict) => {
@ -52,7 +57,7 @@ Zotero.Feeds = new function() {
if (_initPromise) { if (_initPromise) {
await _initPromise; await _initPromise;
} }
Zotero.Feeds.updateFeeds(); await Zotero.Feeds.updateFeeds();
} }
}, },
}, },