1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-06 03:46:47 +01:00
immich/server/test/repositories/database.repository.mock.ts
Jason Rasmussen 50c9bc0336
chore: migrate to vitest (#7156)
* chore: jest => vitest

* chore: replace jest-when
2024-04-16 10:44:45 -04:00

22 lines
880 B
TypeScript

import { IDatabaseRepository } from 'src/interfaces/database.interface';
import { Version } from 'src/utils/version';
import { Mocked, vitest } from 'vitest';
export const newDatabaseRepositoryMock = (): Mocked<IDatabaseRepository> => {
return {
getExtensionVersion: vitest.fn(),
getAvailableExtensionVersion: vitest.fn(),
getPreferredVectorExtension: vitest.fn(),
getPostgresVersion: vitest.fn().mockResolvedValue(new Version(14, 0, 0)),
createExtension: vitest.fn().mockImplementation(() => Promise.resolve()),
updateExtension: vitest.fn(),
updateVectorExtension: vitest.fn(),
reindex: vitest.fn(),
shouldReindex: vitest.fn(),
runMigrations: vitest.fn(),
withLock: vitest.fn().mockImplementation((_, function_: <R>() => Promise<R>) => function_()),
tryLock: vitest.fn(),
isBusy: vitest.fn(),
wait: vitest.fn(),
};
};