diff --git a/server/src/domain/library/library.service.spec.ts b/server/src/domain/library/library.service.spec.ts index 3264371aca..5a7bb47bf3 100644 --- a/server/src/domain/library/library.service.spec.ts +++ b/server/src/domain/library/library.service.spec.ts @@ -72,6 +72,8 @@ describe(LibraryService.name, () => { userMock, databaseMock, ); + + databaseMock.tryLock.mockResolvedValue(true); }); it('should work', () => { @@ -135,7 +137,16 @@ describe(LibraryService.name, () => { ); }); - it('should not initialize when watching is disabled', async () => { + it('should not initialize watcher when watching is disabled', async () => { + configMock.load.mockResolvedValue(systemConfigStub.libraryWatchEnabled); + databaseMock.tryLock.mockResolvedValue(false); + + await sut.init(); + + expect(storageMock.watch).not.toHaveBeenCalled(); + }); + + it('should not initialize watcher when lock is taken', async () => { configMock.load.mockResolvedValue(systemConfigStub.libraryWatchDisabled); await sut.init();