2024-03-21 06:59:49 -05:00
|
|
|
import { IDatabaseRepository } from 'src/interfaces/database.interface';
|
2024-04-16 09:44:45 -05:00
|
|
|
import { Mocked, vitest } from 'vitest';
|
2023-12-21 11:06:26 -05:00
|
|
|
|
2024-04-16 09:44:45 -05:00
|
|
|
export const newDatabaseRepositoryMock = (): Mocked<IDatabaseRepository> => {
|
2023-12-21 11:06:26 -05:00
|
|
|
return {
|
2024-04-16 09:44:45 -05:00
|
|
|
getExtensionVersion: vitest.fn(),
|
|
|
|
getAvailableExtensionVersion: vitest.fn(),
|
2024-05-20 19:31:36 -05:00
|
|
|
getPostgresVersion: vitest.fn().mockResolvedValue('14.10 (Debian 14.10-1.pgdg120+1)'),
|
|
|
|
createExtension: vitest.fn().mockResolvedValue(void 0),
|
2024-04-16 09:44:45 -05:00
|
|
|
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(),
|
2023-12-21 11:06:26 -05:00
|
|
|
};
|
|
|
|
};
|