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:
parent
60befe52e4
commit
fbd21bae16
2 changed files with 3 additions and 24 deletions
|
@ -44,6 +44,8 @@ Zotero.Feeds = new function() {
|
||||||
|
|
||||||
Zotero.Notifier.registerObserver({notify: function(event) {
|
Zotero.Notifier.registerObserver({notify: function(event) {
|
||||||
if (event == 'finish') {
|
if (event == 'finish') {
|
||||||
|
// Don't update during tests, since the database will have been closed
|
||||||
|
if (Zotero.test) return;
|
||||||
Zotero.Feeds.updateFeeds();
|
Zotero.Feeds.updateFeeds();
|
||||||
}
|
}
|
||||||
}}, ['sync'], 'feedsUpdate');
|
}}, ['sync'], 'feedsUpdate');
|
||||||
|
|
|
@ -556,18 +556,6 @@ describe("Zotero.Sync.Runner", function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("#sync()", 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* () {
|
it("should perform a sync across all libraries and update library versions", function* () {
|
||||||
setResponse('keyInfo.fullAccess');
|
setResponse('keyInfo.fullAccess');
|
||||||
setResponse('userGroups.groupVersions');
|
setResponse('userGroups.groupVersions');
|
||||||
|
@ -958,18 +946,7 @@ describe("Zotero.Sync.Runner", function () {
|
||||||
describe("Error Handling", function () {
|
describe("Error Handling", function () {
|
||||||
var win;
|
var win;
|
||||||
|
|
||||||
// Notifier is triggered without waiting for async actions to finish, which
|
afterEach(function () {
|
||||||
// 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();
|
|
||||||
if (win) {
|
if (win) {
|
||||||
win.close();
|
win.close();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue