refactor event type mocks
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { LibraryResponseDto, LibraryService, LoginResponseDto, StorageEvent } from '@app/domain';
|
||||
import { LibraryResponseDto, LibraryService, LoginResponseDto, StorageEventType } from '@app/domain';
|
||||
import { AssetType, LibraryType } from '@app/infra/entities';
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
@@ -57,7 +57,7 @@ describe(`Library watcher (e2e)`, () => {
|
||||
`${IMMICH_TEST_ASSET_TEMP_PATH}/file.jpg`,
|
||||
);
|
||||
|
||||
await waitForEvent(libraryService, StorageEvent.ADD);
|
||||
await waitForEvent(libraryService, StorageEventType.ADD);
|
||||
|
||||
const afterAssets = await api.assetApi.getAllAssets(server, admin.accessToken);
|
||||
expect(afterAssets.length).toEqual(1);
|
||||
@@ -84,7 +84,7 @@ describe(`Library watcher (e2e)`, () => {
|
||||
`${IMMICH_TEST_ASSET_TEMP_PATH}/file5.jPg`,
|
||||
);
|
||||
|
||||
await waitForEvent(libraryService, StorageEvent.ADD, 4);
|
||||
await waitForEvent(libraryService, StorageEventType.ADD, 4);
|
||||
|
||||
const afterAssets = await api.assetApi.getAllAssets(server, admin.accessToken);
|
||||
expect(afterAssets.length).toEqual(4);
|
||||
@@ -96,7 +96,7 @@ describe(`Library watcher (e2e)`, () => {
|
||||
`${IMMICH_TEST_ASSET_TEMP_PATH}/file.jpg`,
|
||||
);
|
||||
|
||||
await waitForEvent(libraryService, StorageEvent.ADD);
|
||||
await waitForEvent(libraryService, StorageEventType.ADD);
|
||||
|
||||
const originalAssets = await api.assetApi.getAllAssets(server, admin.accessToken);
|
||||
expect(originalAssets.length).toEqual(1);
|
||||
@@ -106,7 +106,7 @@ describe(`Library watcher (e2e)`, () => {
|
||||
`${IMMICH_TEST_ASSET_TEMP_PATH}/file.jpg`,
|
||||
);
|
||||
|
||||
await waitForEvent(libraryService, StorageEvent.CHANGE);
|
||||
await waitForEvent(libraryService, StorageEventType.CHANGE);
|
||||
|
||||
const afterAssets = await api.assetApi.getAllAssets(server, admin.accessToken);
|
||||
expect(afterAssets).toEqual([
|
||||
@@ -158,7 +158,7 @@ describe(`Library watcher (e2e)`, () => {
|
||||
`${IMMICH_TEST_ASSET_TEMP_PATH}/dir3/file4.jpg`,
|
||||
);
|
||||
|
||||
await waitForEvent(libraryService, StorageEvent.ADD, 3);
|
||||
await waitForEvent(libraryService, StorageEventType.ADD, 3);
|
||||
|
||||
const assets = await api.assetApi.getAllAssets(server, admin.accessToken);
|
||||
expect(assets.length).toEqual(3);
|
||||
@@ -170,14 +170,14 @@ describe(`Library watcher (e2e)`, () => {
|
||||
`${IMMICH_TEST_ASSET_TEMP_PATH}/dir1/file.jpg`,
|
||||
);
|
||||
|
||||
await waitForEvent(libraryService, StorageEvent.ADD);
|
||||
await waitForEvent(libraryService, StorageEventType.ADD);
|
||||
|
||||
const addedAssets = await api.assetApi.getAllAssets(server, admin.accessToken);
|
||||
expect(addedAssets.length).toEqual(1);
|
||||
|
||||
await fs.unlink(`${IMMICH_TEST_ASSET_TEMP_PATH}/dir1/file.jpg`);
|
||||
|
||||
await waitForEvent(libraryService, StorageEvent.UNLINK);
|
||||
await waitForEvent(libraryService, StorageEventType.UNLINK);
|
||||
|
||||
const afterAssets = await api.assetApi.getAllAssets(server, admin.accessToken);
|
||||
expect(afterAssets[0].isOffline).toEqual(true);
|
||||
|
||||
Reference in New Issue
Block a user