1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-08 12:56:48 +01:00
immich/server/test/repositories/database.repository.mock.ts

14 lines
511 B
TypeScript
Raw Normal View History

import { IDatabaseRepository, Version } from '@app/domain';
export const newDatabaseRepositoryMock = (): jest.Mocked<IDatabaseRepository> => {
return {
getExtensionVersion: jest.fn(),
getPostgresVersion: jest.fn().mockResolvedValue(new Version(14, 0, 0)),
createExtension: jest.fn().mockImplementation(() => Promise.resolve()),
runMigrations: jest.fn(),
withLock: jest.fn().mockImplementation((_, func: <R>() => Promise<R>) => func()),
isBusy: jest.fn(),
wait: jest.fn(),
};
};