1
0
forked from Cutlery/immich
This commit is contained in:
Jonathan Jogenfors 2024-03-17 13:43:27 +01:00
parent 5905fce428
commit 65d3990dce

View File

@ -20,6 +20,7 @@ import {
import { when } from 'jest-when';
import { R_OK } from 'node:constants';
import { Stats } from 'node:fs';
import { usePagination } from '../domain.util';
import { IEntityJob, ILibraryFileJob, ILibraryRefreshJob, JobName } from '../job';
import {
IAssetRepository,
@ -280,6 +281,27 @@ describe(LibraryService.name, () => {
});
});
describe('handleQueueOfflineCheck', () => {
it('should queue a check of each asset', async () => {
const mockLibraryJob: IEntityJob = {
id: libraryStub.externalLibrary1.id,
};
assetMock.getWith.mockResolvedValue({
items: [assetStub.external],
hasNextPage: false,
});
const result = await sut.handleQueueOfflineCheck(mockLibraryJob);
expect(result).toEqual(JobStatus.SUCCESS);
expect(jobMock.queueAll).toHaveBeenCalledWith([
{ name: JobName.LIBRARY_CHECK_OFFLINE, data: { id: assetStub.external.id } },
]);
});
});
describe('handleAssetRefresh', () => {
let mockUser: UserEntity;