chore(server): refactor locks (#5953)

* lock refactor

* add mocks

* add await

* move database repo injection to service

* update tests

* add mock implementation

* remove unused imports

* this
This commit is contained in:
Mert
2023-12-27 18:36:51 -05:00
committed by GitHub
parent 1af27fcc47
commit 8119d4bb26
11 changed files with 90 additions and 72 deletions
@@ -6,5 +6,8 @@ export const newDatabaseRepositoryMock = (): jest.Mocked<IDatabaseRepository> =>
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(),
};
};