Sync engine cleanup
- Use custom exception for user-initiated sync cancellations, which can bubble up to the sync runner -- this should help with a sync stop button (#915) - Separate out deletions-downloading code - Refactor delay generator handling on library version mismatch - Clearer variable names
This commit is contained in:
parent
ab4138cf26
commit
a78f923a72
5 changed files with 235 additions and 172 deletions
|
@ -1631,8 +1631,8 @@ describe("Zotero.Sync.Data.Engine", function () {
|
|||
var wizard = doc.documentElement;
|
||||
wizard.getButton('cancel').click();
|
||||
})
|
||||
var downloadResult = yield engine._startDownload();
|
||||
assert.equal(downloadResult, engine.DOWNLOAD_RESULT_CANCEL);
|
||||
var e = yield getPromiseError(engine._startDownload());
|
||||
assert.isTrue(e instanceof Zotero.Sync.UserCancelledException);
|
||||
|
||||
// Non-conflicted item should be saved
|
||||
assert.ok(Zotero.Items.getIDFromLibraryAndKey(library.id, "AAAAAAAA"));
|
||||
|
@ -1725,8 +1725,8 @@ describe("Zotero.Sync.Data.Engine", function () {
|
|||
var wizard = doc.documentElement;
|
||||
wizard.getButton('cancel').click();
|
||||
})
|
||||
var downloadResult = yield engine._startDownload();
|
||||
assert.equal(downloadResult, engine.DOWNLOAD_RESULT_CANCEL);
|
||||
var e = yield getPromiseError(engine._startDownload());
|
||||
assert.isTrue(e instanceof Zotero.Sync.UserCancelledException);
|
||||
|
||||
// Conflicted items should still exists
|
||||
assert.isTrue(Zotero.Items.exists(itemID1));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue