fix: fixes issue where files imported from another account could not be deleted (#2082)

This commit is contained in:
Mo
2022-12-02 10:13:25 -06:00
committed by GitHub
parent 635e2d9150
commit b5b6192b60
5 changed files with 39 additions and 7 deletions

View File

@@ -145,6 +145,23 @@ describe('fileService', () => {
expect(fileService['encryptedCache'].get(file.uuid)).toBeFalsy()
})
it('if file fails to delete, should present alert asking if they want to remove item', async () => {
const file = {
uuid: '1',
decryptedSize: 100_000,
} as jest.Mocked<FileItem>
const alertMock = (alertService.confirm = jest.fn().mockReturnValue(true))
const deleteItemMock = (itemManager.setItemToBeDeleted = jest.fn())
apiService.deleteFile = jest.fn().mockReturnValue({ error: true })
await fileService.deleteFile(file)
expect(alertMock).toHaveBeenCalledTimes(1)
expect(deleteItemMock).toHaveBeenCalledTimes(1)
})
it('should download file from network if no backup', async () => {
const file = {
uuid: '1',