mirror of
https://github.com/immich-app/immich.git
synced 2024-12-23 02:06:15 +02:00
8119d4bb26
* lock refactor * add mocks * add await * move database repo injection to service * update tests * add mock implementation * remove unused imports * this
14 lines
511 B
TypeScript
14 lines
511 B
TypeScript
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(),
|
|
};
|
|
};
|