forked from Cutlery/immich
		
	add test for already-online assets
This commit is contained in:
		
							parent
							
								
									3fc6e826d5
								
							
						
					
					
						commit
						cba8019243
					
				| @ -306,7 +306,7 @@ describe(LibraryService.name, () => { | ||||
|       expect(assetMock.update).toHaveBeenCalledWith({ id: assetStub.external.id, isOffline: true }); | ||||
|     }); | ||||
| 
 | ||||
|     it('should skip an offline asset', async () => { | ||||
|     it('should skip an already-offline asset', async () => { | ||||
|       const mockAssetJob: ILibraryOfflineJob = { | ||||
|         id: assetStub.external.id, | ||||
|         importPaths: ['/'], | ||||
| @ -322,6 +322,22 @@ describe(LibraryService.name, () => { | ||||
|       expect(assetMock.update).not.toHaveBeenCalled(); | ||||
|     }); | ||||
| 
 | ||||
|     it('should do nothing if asset is still online', async () => { | ||||
|       const mockAssetJob: ILibraryOfflineJob = { | ||||
|         id: assetStub.external.id, | ||||
|         importPaths: ['/'], | ||||
|       }; | ||||
| 
 | ||||
|       assetMock.getById.mockResolvedValue(assetStub.external); | ||||
| 
 | ||||
|       storageMock.checkFileExists.mockResolvedValue(true); | ||||
| 
 | ||||
|       const response = await sut.handleOfflineCheck(mockAssetJob); | ||||
|       expect(response).toBe(JobStatus.SUCCESS); | ||||
| 
 | ||||
|       expect(assetMock.update).not.toHaveBeenCalled(); | ||||
|     }); | ||||
| 
 | ||||
|     it('should skip a nonexistent asset id', async () => { | ||||
|       const mockAssetJob: ILibraryOfflineJob = { | ||||
|         id: assetStub.external.id, | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user