refactor health module, improve code coverage

This commit is contained in:
sbriat
2023-06-21 12:31:59 +02:00
parent b232247c93
commit 1989ff6e67
12 changed files with 63 additions and 266 deletions

View File

@@ -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);
});
});
});