feat: nightly tasks (#19879)

This commit is contained in:
Jason Rasmussen
2025-07-11 17:32:10 -04:00
committed by GitHub
parent df581cc0d5
commit 47c0dc0d7e
21 changed files with 538 additions and 60 deletions

View File

@@ -3,7 +3,7 @@ import { Stats } from 'node:fs';
import { defaults, SystemConfig } from 'src/config';
import { JOBS_LIBRARY_PAGINATION_SIZE } from 'src/constants';
import { mapLibrary } from 'src/dtos/library.dto';
import { AssetType, ImmichWorker, JobName, JobStatus } from 'src/enum';
import { AssetType, CronJob, ImmichWorker, JobName, JobStatus } from 'src/enum';
import { LibraryService } from 'src/services/library.service';
import { ILibraryBulkIdsJob, ILibraryFileJob } from 'src/types';
import { assetStub } from 'test/fixtures/asset.stub';
@@ -56,7 +56,11 @@ describe(LibraryService.name, () => {
} as SystemConfig,
});
expect(mocks.cron.update).toHaveBeenCalledWith({ name: 'libraryScan', expression: '0 1 * * *', start: true });
expect(mocks.cron.update).toHaveBeenCalledWith({
name: CronJob.LibraryScan,
expression: '0 1 * * *',
start: true,
});
});
it('should initialize watcher for all external libraries', async () => {
@@ -128,7 +132,7 @@ describe(LibraryService.name, () => {
});
expect(mocks.cron.update).toHaveBeenCalledWith({
name: 'libraryScan',
name: CronJob.LibraryScan,
expression: systemConfigStub.libraryScan.library.scan.cronExpression,
start: systemConfigStub.libraryScan.library.scan.enabled,
});
@@ -149,7 +153,7 @@ describe(LibraryService.name, () => {
});
expect(mocks.cron.update).toHaveBeenCalledWith({
name: 'libraryScan',
name: CronJob.LibraryScan,
expression: systemConfigStub.libraryScan.library.scan.cronExpression,
start: systemConfigStub.libraryScan.library.scan.enabled,
});