1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-04 02:46:47 +01:00
immich/server/test/repositories/config.repository.mock.ts

59 lines
1.4 KiB
TypeScript
Raw Normal View History

2024-10-03 21:28:36 +02:00
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 = {
2024-10-03 19:29:40 +02:00
port: 3001,
environment: ImmichEnvironment.PRODUCTION,
buildMetadata: {},
database: {
2024-10-03 23:48:40 +02:00
host: 'database',
port: 5432,
username: 'postgres',
password: 'postgres',
name: 'immich',
skipMigrations: false,
vectorExtension: DatabaseExtension.VECTORS,
},
licensePublicKey: {
client: 'client-public-key',
server: 'server-public-key',
},
resourcePaths: {
lockFile: 'build-lock.json',
geodata: {
dateFile: '/build/geodata/geodata-date.txt',
admin1: '/build/geodata/admin1CodesASCII.txt',
admin2: '/build/geodata/admin2Codes.txt',
cities500: '/build/geodata/cities500.txt',
naturalEarthCountriesPath: 'build/ne_10m_admin_0_countries.geojson',
},
web: {
root: '/build/www',
indexHtml: '/build/www/index.html',
},
},
storage: {
ignoreMountCheckErrors: false,
},
2024-10-03 21:28:36 +02:00
workers: [ImmichWorker.API, ImmichWorker.MICROSERVICES],
noColor: false,
};
export const newConfigRepositoryMock = (): Mocked<IConfigRepository> => {
return {
getEnv: vitest.fn().mockReturnValue(envData),
};
};
export const mockEnvData = (config: Partial<EnvData>) => ({ ...envData, ...config });