mirror of
https://gitlab.com/mobicoop/v3/service/ad.git
synced 2026-03-25 03:45:51 +00:00
refactor health module, improve code coverage
This commit is contained in:
@@ -12,7 +12,7 @@ const mockAdRepository = {
|
||||
return Promise.resolve(true);
|
||||
})
|
||||
.mockImplementation(() => {
|
||||
throw new DatabaseErrorException('an error occured in the database');
|
||||
throw new DatabaseErrorException('An error occured in the database');
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -56,9 +56,11 @@ describe('RepositoriesHealthIndicatorUseCase', () => {
|
||||
});
|
||||
|
||||
it('should throw an error if database is unavailable', async () => {
|
||||
jest.spyOn(mockMessagePublisher, 'publish');
|
||||
await expect(
|
||||
repositoriesHealthIndicatorUseCase.isHealthy('repositories'),
|
||||
).rejects.toBeInstanceOf(HealthCheckError);
|
||||
expect(mockMessagePublisher.publish).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user