Skip to content

Commit e3d76bf

Browse files
committed
[ML] Fix jest tests.
1 parent 8875b64 commit e3d76bf

2 files changed

Lines changed: 9 additions & 79 deletions

File tree

x-pack/legacy/plugins/ml/public/application/components/navigation_menu/top_nav/__snapshots__/top_nav.test.tsx.snap

Lines changed: 0 additions & 76 deletions
This file was deleted.

x-pack/legacy/plugins/ml/public/application/components/navigation_menu/top_nav/top_nav.test.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
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 React from 'react';
9+
import { MemoryRouter } from 'react-router-dom';
910

1011
import { EuiSuperDatePicker } from '@elastic/eui';
1112

@@ -34,8 +35,13 @@ describe('Navigation Menu: <TopNav />', () => {
3435
const refreshListener = jest.fn();
3536
const refreshSubscription = mlTimefilterRefresh$.subscribe(refreshListener);
3637

37-
const wrapper = shallow(<TopNav />);
38-
expect(wrapper).toMatchSnapshot();
38+
const wrapper = mount(
39+
<MemoryRouter>
40+
<TopNav />
41+
</MemoryRouter>
42+
);
43+
expect(wrapper.find(TopNav)).toHaveLength(1);
44+
expect(wrapper.find('EuiSuperDatePicker')).toHaveLength(1);
3945
expect(refreshListener).toBeCalledTimes(0);
4046

4147
refreshSubscription.unsubscribe();

0 commit comments

Comments
 (0)