1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-06 09:19:22 +02:00

Core: Fixed potential out-of-sync issue if user cancels while in the middle of delta step

This commit is contained in:
Laurent Cozic
2017-11-21 18:17:50 +00:00
parent 585ccc2b8b
commit c5214b6c44
2 changed files with 41 additions and 6 deletions

View File

@@ -606,5 +606,25 @@ describe('Synchronizer', function() {
done();
});
it('items should be downloaded again when user cancels in the middle of delta operation', async (done) => {
let folder1 = await Folder.save({ title: "folder1" });
let note1 = await Note.save({ title: "un", is_todo: 1, parent_id: folder1.id });
await synchronizer().start();
await switchClient(2);
synchronizer().debugFlags_ = ['cancelDeltaLoop2'];
let context = await synchronizer().start();
let notes = await Note.all();
expect(notes.length).toBe(0);
synchronizer().debugFlags_ = [];
await synchronizer().start({ context: context });
notes = await Note.all();
expect(notes.length).toBe(1);
done();
});
});