refactor(server): cron validation (#13990)

This commit is contained in:
Jason Rasmussen 2024-11-07 12:27:52 -05:00 committed by GitHub
parent dc2de47204
commit e84ad084d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 40 additions and 78 deletions

View file

@ -177,26 +177,6 @@ describe(LibraryService.name, () => {
});
});
describe('onConfigValidateEvent', () => {
it('should allow a valid cron expression', () => {
expect(() =>
sut.onConfigValidate({
newConfig: { library: { scan: { cronExpression: '0 0 * * *' } } } as SystemConfig,
oldConfig: {} as SystemConfig,
}),
).not.toThrow(expect.stringContaining('Invalid cron expression'));
});
it('should fail for an invalid cron expression', () => {
expect(() =>
sut.onConfigValidate({
newConfig: { library: { scan: { cronExpression: 'foo' } } } as SystemConfig,
oldConfig: {} as SystemConfig,
}),
).toThrow(/Invalid cron expression.*/);
});
});
describe('handleQueueSyncFiles', () => {
it('should queue refresh of a new asset', async () => {
libraryMock.get.mockResolvedValue(libraryStub.externalLibrary1);