mirror of
https://github.com/immich-app/immich.git
synced 2025-01-17 01:06:46 +01:00
3da750117f
* refactor: migrate user repository to kysely * refactor: migrate user repository to kysely * refactor: migrate user repository to kysely * refactor: migrate user repository to kysely * fix: test * clean up * fix: metadata retrieval bug * use correct typeing for upsert metadata * pr feedback * pr feedback * fix: add deletedAt check * fix: get non deleted user by default * remove console.log * fix: stop kysely after command finishes * final clean up --------- Co-authored-by: Jason Rasmussen <jason@rasm.me>
23 lines
894 B
TypeScript
23 lines
894 B
TypeScript
import { IDatabaseRepository } from 'src/interfaces/database.interface';
|
|
import { Mocked, vitest } from 'vitest';
|
|
|
|
export const newDatabaseRepositoryMock = (): Mocked<IDatabaseRepository> => {
|
|
return {
|
|
init: vitest.fn(),
|
|
shutdown: vitest.fn(),
|
|
reconnect: vitest.fn(),
|
|
getExtensionVersion: vitest.fn(),
|
|
getExtensionVersionRange: vitest.fn(),
|
|
getPostgresVersion: vitest.fn().mockResolvedValue('14.10 (Debian 14.10-1.pgdg120+1)'),
|
|
getPostgresVersionRange: vitest.fn().mockReturnValue('>=14.0.0'),
|
|
createExtension: vitest.fn().mockResolvedValue(void 0),
|
|
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(),
|
|
};
|
|
};
|