2024-10-03 15:28:36 -04:00
|
|
|
import { ImmichEnvironment, ImmichWorker } from 'src/enum';
|
2024-10-01 13:04:37 -04:00
|
|
|
import { EnvData, IConfigRepository } from 'src/interfaces/config.interface';
|
2024-09-27 10:28:56 -04:00
|
|
|
import { DatabaseExtension } from 'src/interfaces/database.interface';
|
|
|
|
import { Mocked, vitest } from 'vitest';
|
|
|
|
|
2024-10-01 13:04:37 -04:00
|
|
|
const envData: EnvData = {
|
2024-10-03 13:29:40 -04:00
|
|
|
port: 3001,
|
2024-10-02 08:37:26 -04:00
|
|
|
environment: ImmichEnvironment.PRODUCTION,
|
|
|
|
|
2024-10-01 13:04:37 -04:00
|
|
|
database: {
|
|
|
|
skipMigrations: false,
|
|
|
|
vectorExtension: DatabaseExtension.VECTORS,
|
|
|
|
},
|
2024-10-02 08:37:26 -04:00
|
|
|
|
2024-10-03 15:45:37 -04:00
|
|
|
licensePublicKey: {
|
|
|
|
client: 'client-public-key',
|
|
|
|
server: 'server-public-key',
|
|
|
|
},
|
|
|
|
|
2024-10-01 13:04:37 -04:00
|
|
|
storage: {
|
|
|
|
ignoreMountCheckErrors: false,
|
|
|
|
},
|
2024-10-03 15:28:36 -04:00
|
|
|
|
|
|
|
workers: [ImmichWorker.API, ImmichWorker.MICROSERVICES],
|
2024-10-01 13:04:37 -04:00
|
|
|
};
|
|
|
|
|
2024-09-27 10:28:56 -04:00
|
|
|
export const newConfigRepositoryMock = (): Mocked<IConfigRepository> => {
|
|
|
|
return {
|
2024-10-01 13:04:37 -04:00
|
|
|
getEnv: vitest.fn().mockReturnValue(envData),
|
2024-09-27 10:28:56 -04:00
|
|
|
};
|
|
|
|
};
|
2024-10-01 13:04:37 -04:00
|
|
|
|
|
|
|
export const mockEnvData = (config: Partial<EnvData>) => ({ ...envData, ...config });
|