-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix-repo-root-finding-for-ci
- Loading branch information
Showing
25 changed files
with
495 additions
and
35 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
42 changes: 42 additions & 0 deletions
42
...ases/public/components/user_action_tree/user_action_host_isolation_comment_event.test.tsx
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,42 @@ | ||
/* | ||
* 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 React from 'react'; | ||
import { mount } from 'enzyme'; | ||
import { HostIsolationCommentEvent } from './user_action_host_isolation_comment_event'; | ||
|
||
const defaultProps = () => { | ||
return { | ||
type: 'isolate', | ||
endpoints: [{ endpointId: 'e1', hostname: 'host1' }], | ||
href: jest.fn(), | ||
onClick: jest.fn(), | ||
}; | ||
}; | ||
|
||
describe('UserActionHostIsolationCommentEvent', () => { | ||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
it('renders with the correct action and hostname', async () => { | ||
const wrapper = mount(<HostIsolationCommentEvent {...defaultProps()} />); | ||
expect(wrapper.find(`[data-test-subj="actions-link-e1"]`).first().exists()).toBeTruthy(); | ||
expect(wrapper.text()).toBe('isolated host host1'); | ||
}); | ||
|
||
it('navigates to app on link click', async () => { | ||
const onActionsLinkClick = jest.fn(); | ||
|
||
const wrapper = mount( | ||
<HostIsolationCommentEvent {...defaultProps()} onClick={onActionsLinkClick} /> | ||
); | ||
|
||
wrapper.find(`[data-test-subj="actions-link-e1"]`).first().simulate('click'); | ||
expect(onActionsLinkClick).toHaveBeenCalled(); | ||
}); | ||
}); |
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
Oops, something went wrong.