1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-27 23:28:38 +02:00

All: Fixes #5223: Fixed issue with orphaned resource being created in case of a resource conflict

This commit is contained in:
Laurent Cozic
2021-08-05 14:25:25 +01:00
parent d3cd843fc8
commit f08af4d036
2 changed files with 27 additions and 4 deletions

View File

@ -254,14 +254,21 @@ describe('Synchronizer.resources', function() {
// attached to it, and check that it has the original content.
const allNotes = await Note.all();
expect(allNotes.length).toBe(2);
const resourceConflictFolderId = await Resource.resourceConflictFolderId();
const conflictNote = allNotes.find((v: NoteEntity) => {
return !!v.is_conflict;
return v.parent_id === resourceConflictFolderId;
});
expect(!!conflictNote).toBe(true);
const resourceIds = await Note.linkedResourceIds(conflictNote.body);
expect(resourceIds.length).toBe(1);
const conflictContent = await Resource.resourceBlobContent(resourceIds[0], 'utf8');
expect(conflictContent).toBe('1234 MOD 1');
// Also check that the conflict folder has been created and that it
// is a top folder.
const resourceConflictFolder = await Folder.load(resourceConflictFolderId);
expect(resourceConflictFolder).toBeTruthy();
expect(resourceConflictFolder.parent_id).toBeFalsy();
}
}));