Skip to content

Commit

Permalink
test if ml is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
mertalev committed May 8, 2024
1 parent ea83cc9 commit 4c5bab8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions server/src/services/search.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,26 @@ describe(SearchService.name, () => {
});

describe('handleSearchDuplicates', () => {
it('should skip if machine learning is disabled', async () => {
configMock.load.mockResolvedValue([{ key: SystemConfigKey.MACHINE_LEARNING_ENABLED, value: false }]);
const id = assetStub.livePhotoMotionAsset.id;
assetMock.getById.mockResolvedValue(assetStub.livePhotoMotionAsset);

const result = await sut.handleSearchDuplicates({ id });

expect(result).toBe(JobStatus.SKIPPED);
});

it('should skip if clip is disabled', async () => {
configMock.load.mockResolvedValue([{ key: SystemConfigKey.MACHINE_LEARNING_CLIP_ENABLED, value: false }]);
const id = assetStub.livePhotoMotionAsset.id;
assetMock.getById.mockResolvedValue(assetStub.livePhotoMotionAsset);

const result = await sut.handleSearchDuplicates({ id });

expect(result).toBe(JobStatus.SKIPPED);
});

it('should fail if asset is not found', async () => {
const result = await sut.handleSearchDuplicates({ id: assetStub.image.id });

Expand Down

0 comments on commit 4c5bab8

Please sign in to comment.