mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
(cherry picked from commit e1aa6a6d24
)
Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
This commit is contained in:
parent
42418b83ca
commit
c41d09d28c
2 changed files with 10 additions and 6 deletions
|
@ -15,6 +15,8 @@ import { restartRiskScoreTransforms } from './utils';
|
|||
|
||||
jest.mock('./utils');
|
||||
|
||||
const mockRestartRiskScoreTransforms = restartRiskScoreTransforms as jest.Mock;
|
||||
|
||||
describe('RiskScoreRestartButton', () => {
|
||||
const mockRefetch = jest.fn();
|
||||
beforeEach(() => {
|
||||
|
@ -33,7 +35,7 @@ describe('RiskScoreRestartButton', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('calls restartRiskScoreTransforms', async () => {
|
||||
it('calls restartRiskScoreTransforms with correct entity', async () => {
|
||||
render(
|
||||
<TestProviders>
|
||||
<RiskScoreRestartButton refetch={mockRefetch} riskScoreEntity={riskScoreEntity} />
|
||||
|
@ -43,8 +45,10 @@ describe('RiskScoreRestartButton', () => {
|
|||
await act(async () => {
|
||||
await userEvent.click(screen.getByTestId(`restart_${riskScoreEntity}_risk_score`));
|
||||
});
|
||||
|
||||
expect(restartRiskScoreTransforms).toHaveBeenCalled();
|
||||
expect(mockRestartRiskScoreTransforms).toHaveBeenCalled();
|
||||
expect(mockRestartRiskScoreTransforms.mock.calls[0][0].riskScoreEntity).toEqual(
|
||||
riskScoreEntity
|
||||
);
|
||||
});
|
||||
|
||||
it('Update button state while installing', async () => {
|
||||
|
|
|
@ -9,7 +9,7 @@ import { EuiButton } from '@elastic/eui';
|
|||
import React, { useCallback } from 'react';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
|
||||
import { RiskScoreEntity } from '../../../../../common/search_strategy';
|
||||
import type { RiskScoreEntity } from '../../../../../common/search_strategy';
|
||||
import { useSpaceId } from '../../../hooks/use_space_id';
|
||||
import { useKibana } from '../../../lib/kibana';
|
||||
import type { inputsModel } from '../../../store';
|
||||
|
@ -39,11 +39,11 @@ const RiskScoreRestartButtonComponent = ({
|
|||
notifications,
|
||||
refetch,
|
||||
renderDocLink,
|
||||
riskScoreEntity: RiskScoreEntity.host,
|
||||
riskScoreEntity,
|
||||
spaceId,
|
||||
theme,
|
||||
});
|
||||
}, [fetch, http, notifications, refetch, renderDocLink, spaceId, theme]);
|
||||
}, [fetch, http, notifications, refetch, renderDocLink, riskScoreEntity, spaceId, theme]);
|
||||
|
||||
return (
|
||||
<EuiButton
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue