From 57626101acadbc99169ce90b968a76ca19bdd3e7 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 24 Feb 2017 03:50:31 -0500 Subject: [PATCH] Fix incorrect tests due to the bug fixed in b21729edd17 --- chrome/content/zotero/xpcom/sync/syncLocal.js | 6 +----- test/tests/syncLocalTest.js | 4 ++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/xpcom/sync/syncLocal.js b/chrome/content/zotero/xpcom/sync/syncLocal.js index 15ce16b89..197759bae 100644 --- a/chrome/content/zotero/xpcom/sync/syncLocal.js +++ b/chrome/content/zotero/xpcom/sync/syncLocal.js @@ -183,11 +183,8 @@ Zotero.Sync.Data.Local = { var library = Zotero.Libraries.get(libraryID); // If library is going from editable to non-editable and there's unsynced local data, prompt - if (library.editable && !editable - && ((yield this._libraryHasUnsyncedData(libraryID)) - || (yield this._libraryHasUnsyncedFiles(libraryID)))) { + if (library.editable && !editable && (yield this._libraryHasUnsyncedData(libraryID))) { let index = Zotero.Sync.Data.Utilities.showWriteAccessLostPrompt(win, library); - // Reset library if (index == 0) { // This check happens before item data is loaded for syncing, so do it now, @@ -205,7 +202,6 @@ Zotero.Sync.Data.Local = { if (library.filesEditable && !filesEditable && (yield this._libraryHasUnsyncedFiles(libraryID))) { let index = Zotero.Sync.Storage.Utilities.showFileWriteAccessLostPrompt(win, library); - // Reset library files if (index == 0) { // This check happens before item data is loaded for syncing, so do it now, diff --git a/test/tests/syncLocalTest.js b/test/tests/syncLocalTest.js index 085f33556..418bc0fb8 100644 --- a/test/tests/syncLocalTest.js +++ b/test/tests/syncLocalTest.js @@ -110,6 +110,7 @@ describe("Zotero.Sync.Data.Local", function() { }); var mock = sinon.mock(Zotero.Sync.Data.Local); + mock.expects("_libraryHasUnsyncedData").once().returns(Zotero.Promise.resolve(true)); mock.expects("resetUnsyncedLibraryData").once().returns(Zotero.Promise.resolve()); mock.expects("resetUnsyncedLibraryFiles").never(); @@ -130,6 +131,7 @@ describe("Zotero.Sync.Data.Local", function() { }, "cancel"); var mock = sinon.mock(Zotero.Sync.Data.Local); + mock.expects("_libraryHasUnsyncedData").once().returns(Zotero.Promise.resolve(true)); mock.expects("resetUnsyncedLibraryData").never(); mock.expects("resetUnsyncedLibraryFiles").never(); @@ -159,6 +161,7 @@ describe("Zotero.Sync.Data.Local", function() { }); var mock = sinon.mock(Zotero.Sync.Data.Local); + mock.expects("_libraryHasUnsyncedFiles").once().returns(Zotero.Promise.resolve(true)); mock.expects("resetUnsyncedLibraryData").never(); mock.expects("resetUnsyncedLibraryFiles").once().returns(Zotero.Promise.resolve()); @@ -179,6 +182,7 @@ describe("Zotero.Sync.Data.Local", function() { }, "cancel"); var mock = sinon.mock(Zotero.Sync.Data.Local); + mock.expects("_libraryHasUnsyncedFiles").once().returns(Zotero.Promise.resolve(true)); mock.expects("resetUnsyncedLibraryData").never(); mock.expects("resetUnsyncedLibraryFiles").never();