Skip to content

Commit 1fa6e33

Browse files
update unit tests
1 parent 339a5e9 commit 1fa6e33

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

x-pack/legacy/plugins/siem/public/components/navigation/tab_navigation/index.test.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
import { mount, shallow } from 'enzyme';
7+
import { mount } from 'enzyme';
88
import * as React from 'react';
99

1010
import { navTabs } from '../../../pages/home/home_navigations';
@@ -60,13 +60,13 @@ describe('Tab Navigation', () => {
6060
},
6161
};
6262
test('it mounts with correct tab highlighted', () => {
63-
const wrapper = shallow(<TabNavigationComponent {...mockProps} />);
64-
const hostsTab = wrapper.find('[data-test-subj="navigation-hosts"]');
63+
const wrapper = mount(<TabNavigationComponent {...mockProps} />);
64+
const hostsTab = wrapper.find('EuiTab[data-test-subj="navigation-hosts"]');
6565
expect(hostsTab.prop('isSelected')).toBeTruthy();
6666
});
6767
test('it changes active tab when nav changes by props', () => {
6868
const wrapper = mount(<TabNavigationComponent {...mockProps} />);
69-
const networkTab = () => wrapper.find('[data-test-subj="navigation-network"]').first();
69+
const networkTab = () => wrapper.find('EuiTab[data-test-subj="navigation-network"]').first();
7070
expect(networkTab().prop('isSelected')).toBeFalsy();
7171
wrapper.setProps({
7272
pageName: 'network',
@@ -77,8 +77,8 @@ describe('Tab Navigation', () => {
7777
expect(networkTab().prop('isSelected')).toBeTruthy();
7878
});
7979
test('it carries the url state in the link', () => {
80-
const wrapper = shallow(<TabNavigationComponent {...mockProps} />);
81-
const firstTab = wrapper.find('[data-test-subj="navigation-network"]');
80+
const wrapper = mount(<TabNavigationComponent {...mockProps} />);
81+
const firstTab = wrapper.find('EuiTab[data-test-subj="navigation-network"]');
8282
expect(firstTab.props().href).toBe(
8383
"#/link-to/network?query=(language:kuery,query:'host.name:%22siem-es%22')&timerange=(global:(linkTo:!(timeline),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)),timeline:(linkTo:!(global),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)))"
8484
);
@@ -124,9 +124,9 @@ describe('Tab Navigation', () => {
124124
},
125125
};
126126
test('it mounts with correct tab highlighted', () => {
127-
const wrapper = shallow(<TabNavigationComponent {...mockProps} />);
127+
const wrapper = mount(<TabNavigationComponent {...mockProps} />);
128128
const tableNavigationTab = wrapper.find(
129-
`[data-test-subj="navigation-${HostsTableType.authentications}"]`
129+
`EuiTab[data-test-subj="navigation-${HostsTableType.authentications}"]`
130130
);
131131

132132
expect(tableNavigationTab.prop('isSelected')).toBeTruthy();
@@ -145,9 +145,9 @@ describe('Tab Navigation', () => {
145145
expect(tableNavigationTab().prop('isSelected')).toBeTruthy();
146146
});
147147
test('it carries the url state in the link', () => {
148-
const wrapper = shallow(<TabNavigationComponent {...mockProps} />);
148+
const wrapper = mount(<TabNavigationComponent {...mockProps} />);
149149
const firstTab = wrapper.find(
150-
`[data-test-subj="navigation-${HostsTableType.authentications}"]`
150+
`EuiTab[data-test-subj="navigation-${HostsTableType.authentications}"]`
151151
);
152152
expect(firstTab.props().href).toBe(
153153
`#/${pageName}/${hostName}/${HostsTableType.authentications}?query=(language:kuery,query:'host.name:%22siem-es%22')&timerange=(global:(linkTo:!(timeline),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)),timeline:(linkTo:!(global),timerange:(from:1558048243696,fromStr:now-24h,kind:relative,to:1558134643697,toStr:now)))`

x-pack/legacy/plugins/siem/public/components/navigation/tab_navigation/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export const TabNavigationComponent = (props: TabNavigationProps) => {
7979
/>
8080
);
8181
}),
82-
[navTabs]
82+
[navTabs, selectedTabId]
8383
);
8484

8585
return <EuiTabs display={display}>{renderTabs}</EuiTabs>;

x-pack/legacy/plugins/siem/public/components/paginated_table/__snapshots__/index.test.tsx.snap

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)