0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-07 00:50:23 -05:00
immich/server/test/repositories/config.repository.mock.ts
2024-10-03 15:28:36 -04:00

28 lines
780 B
TypeScript

import { ImmichEnvironment, ImmichWorker } from 'src/enum';
import { EnvData, IConfigRepository } from 'src/interfaces/config.interface';
import { DatabaseExtension } from 'src/interfaces/database.interface';
import { Mocked, vitest } from 'vitest';
const envData: EnvData = {
port: 3001,
environment: ImmichEnvironment.PRODUCTION,
database: {
skipMigrations: false,
vectorExtension: DatabaseExtension.VECTORS,
},
storage: {
ignoreMountCheckErrors: false,
},
workers: [ImmichWorker.API, ImmichWorker.MICROSERVICES],
};
export const newConfigRepositoryMock = (): Mocked<IConfigRepository> => {
return {
getEnv: vitest.fn().mockReturnValue(envData),
};
};
export const mockEnvData = (config: Partial<EnvData>) => ({ ...envData, ...config });