diff --git a/server/src/domain/library/library.service.spec.ts b/server/src/domain/library/library.service.spec.ts index c907f6f48..3266479f1 100644 --- a/server/src/domain/library/library.service.spec.ts +++ b/server/src/domain/library/library.service.spec.ts @@ -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,