mirror of
https://github.com/immich-app/immich.git
synced 2025-03-11 02:23:09 -05:00
unit test for library watch lock
This commit is contained in:
parent
91b9ea5f0e
commit
fa51503309
1 changed files with 12 additions and 1 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue