-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution][Entity details] - move osquery, response and inve…
…stigation guide related hooks and components to flyout folder (#190110)
- Loading branch information
1 parent
35c0671
commit 04503bf
Showing
12 changed files
with
114 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...rity_solution/public/flyout/document_details/left/hooks/use_response_actions_view.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { renderHook } from '@testing-library/react-hooks'; | ||
import { useResponseActionsView } from './use_response_actions_view'; | ||
import { mockSearchHit } from '../../shared/mocks/mock_search_hit'; | ||
import { mockDataAsNestedObject } from '../../shared/mocks/mock_data_as_nested_object'; | ||
import { useGetAutomatedActionList } from '../../../../management/hooks/response_actions/use_get_automated_action_list'; | ||
import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features'; | ||
|
||
const ecsData = mockDataAsNestedObject; | ||
const rawEventData = mockSearchHit; | ||
|
||
jest.mock('../../../../common/hooks/use_experimental_features'); | ||
jest.mock('../../../../management/hooks/response_actions/use_get_automated_action_list'); | ||
|
||
describe('useResponseActionsView', () => { | ||
it('should return the normal component', () => { | ||
(useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true); | ||
(useGetAutomatedActionList as jest.Mock).mockReturnValue({ | ||
data: [], | ||
isFetched: true, | ||
}); | ||
|
||
const { result } = renderHook(() => | ||
useResponseActionsView({ | ||
ecsData, | ||
rawEventData, | ||
}) | ||
); | ||
|
||
expect(result.current.id).toEqual('response-actions-results-view'); | ||
expect(result.current.name).toEqual('Response Results'); | ||
expect(result.current.append).toBeDefined(); | ||
expect(result.current.content).toBeDefined(); | ||
}); | ||
|
||
it('returns early return if rawEventData is undefined', () => { | ||
(useIsExperimentalFeatureEnabled as jest.Mock).mockReturnValue(true); | ||
(useGetAutomatedActionList as jest.Mock).mockReturnValue({ | ||
data: [], | ||
isFetched: true, | ||
}); | ||
|
||
const { result } = renderHook(() => | ||
useResponseActionsView({ | ||
ecsData, | ||
rawEventData: undefined, | ||
}) | ||
); | ||
|
||
expect(result.current.id).toEqual('response-actions-results-view'); | ||
expect(result.current.name).toEqual('Response Results'); | ||
expect(result.current.append).not.toBeDefined(); | ||
expect(result.current.content).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters