Skip to content

Commit

Permalink
[SIEM] Cleanup unnecessary use of enzyme-to-json (#53980)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrykkopycinski authored Jan 8, 2020
1 parent b7284ca commit 8eb000d
Show file tree
Hide file tree
Showing 134 changed files with 158 additions and 292 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { mount } from 'enzyme';
import toJson from 'enzyme-to-json';
import React from 'react';

import { TestProviders } from '../../mock';
Expand All @@ -20,7 +19,7 @@ describe('arrows', () => {
<ArrowBody height={3} />
</TestProviders>
);
expect(toJson(wrapper.find('ArrowBody'))).toMatchSnapshot();
expect(wrapper.find('ArrowBody')).toMatchSnapshot();
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import { EuiFieldSearch } from '@elastic/eui';
import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json';
import { mount, shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import { noop } from 'lodash/fp';
import React from 'react';
import { ThemeProvider } from 'styled-components';
Expand Down Expand Up @@ -117,7 +116,7 @@ describe('Autocomplete', () => {
value={''}
/>
);
expect(toJson(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});

test('it is rendering with placeholder', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json';
import { mount, shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import React from 'react';

import { TestProviders } from '../../../mock';
Expand Down Expand Up @@ -44,7 +43,7 @@ describe('UtilityBar', () => {
</TestProviders>
);

expect(toJson(wrapper.find('UtilityBar'))).toMatchSnapshot();
expect(wrapper.find('UtilityBar')).toMatchSnapshot();
});

test('it applies border styles when border is true', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { mount, shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import React from 'react';

import { TestProviders } from '../../../mock';
Expand All @@ -19,7 +18,7 @@ describe('UtilityBarAction', () => {
</TestProviders>
);

expect(toJson(wrapper.find('UtilityBarAction'))).toMatchSnapshot();
expect(wrapper.find('UtilityBarAction')).toMatchSnapshot();
});

test('it renders a popover', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import React from 'react';

import { TestProviders } from '../../../mock';
Expand All @@ -21,6 +20,6 @@ describe('UtilityBarGroup', () => {
</TestProviders>
);

expect(toJson(wrapper.find('UtilityBarGroup'))).toMatchSnapshot();
expect(wrapper.find('UtilityBarGroup')).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import React from 'react';

import { TestProviders } from '../../../mock';
Expand All @@ -23,6 +22,6 @@ describe('UtilityBarSection', () => {
</TestProviders>
);

expect(toJson(wrapper.find('UtilityBarSection'))).toMatchSnapshot();
expect(wrapper.find('UtilityBarSection')).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import React from 'react';

import { TestProviders } from '../../../mock';
Expand All @@ -19,6 +18,6 @@ describe('UtilityBarText', () => {
</TestProviders>
);

expect(toJson(wrapper.find('UtilityBarText'))).toMatchSnapshot();
expect(wrapper.find('UtilityBarText')).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { mount, shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import React from 'react';
import { MockedProvider } from 'react-apollo/test-utils';

Expand All @@ -28,7 +27,7 @@ describe('DragDropContextWrapper', () => {
</MockedProvider>
</TestProviders>
);
expect(toJson(wrapper.find('DragDropContextWrapper'))).toMatchSnapshot();
expect(wrapper.find('DragDropContextWrapper')).toMatchSnapshot();
});

test('it renders the children', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import React from 'react';
import { MockedProvider } from 'react-apollo/test-utils';

Expand Down Expand Up @@ -33,7 +32,7 @@ describe('DraggableWrapper', () => {
</TestProviders>
);

expect(toJson(wrapper.find('DraggableWrapper'))).toMatchSnapshot();
expect(wrapper.find('DraggableWrapper')).toMatchSnapshot();
});

test('it renders the children passed to the render prop', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import React from 'react';
import { MockedProvider } from 'react-apollo/test-utils';

Expand Down Expand Up @@ -33,7 +32,7 @@ describe('DroppableWrapper', () => {
</TestProviders>
);

expect(toJson(wrapper.find('DroppableWrapper'))).toMatchSnapshot();
expect(wrapper.find('DroppableWrapper')).toMatchSnapshot();
});

test('it renders the children when a render prop is not provided', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import React from 'react';

import { TestProviders } from '../../mock';
Expand Down Expand Up @@ -34,7 +33,7 @@ describe('draggables', () => {
<span>{'A child of this'}</span>
</DefaultDraggable>
);
expect(toJson(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});

test('it renders the default Badge', () => {
Expand All @@ -50,7 +49,7 @@ describe('draggables', () => {
<span>{'A child of this'}</span>
</DraggableBadge>
);
expect(toJson(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import React from 'react';

import { Embeddable } from './embeddable';
Expand All @@ -18,6 +17,6 @@ describe('Embeddable', () => {
</Embeddable>
);

expect(toJson(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { mount, shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import React from 'react';

import { TestProviders } from '../../mock';
Expand All @@ -15,7 +14,7 @@ describe('EmbeddableHeader', () => {
test('it renders', () => {
const wrapper = shallow(<EmbeddableHeader title="Test title" />);

expect(toJson(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});

test('it renders the title', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import React from 'react';

import { useIndexPatterns } from '../../hooks/use_index_patterns';
Expand Down Expand Up @@ -41,6 +40,6 @@ describe('EmbeddedMapComponent', () => {
startDate={new Date('2019-08-28T05:50:47.877Z').getTime()}
/>
);
expect(toJson(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import React from 'react';

import { IndexPatternsMissingPromptComponent } from './index_patterns_missing_prompt';
Expand All @@ -15,6 +14,6 @@ jest.mock('../../lib/kibana');
describe('IndexPatternsMissingPrompt', () => {
test('renders correctly against snapshot', () => {
const wrapper = shallow(<IndexPatternsMissingPromptComponent />);
expect(toJson(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import React from 'react';
import { LineToolTipContentComponent } from './line_tool_tip_content';
import { FeatureProperty } from '../types';
Expand All @@ -27,6 +26,6 @@ describe('LineToolTipContent', () => {
const wrapper = shallow(
<LineToolTipContentComponent contextId={'contextId'} featureProps={mockFeatureProps} />
);
expect(toJson(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import React from 'react';
import { MapToolTipComponent } from './map_tool_tip';
import { MapFeature } from '../types';
Expand All @@ -19,7 +18,7 @@ jest.mock('../../search_bar', () => ({
describe('MapToolTip', () => {
test('placeholder component renders correctly against snapshot', () => {
const wrapper = shallow(<MapToolTipComponent />);
expect(toJson(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});

test('full component renders correctly against snapshot', () => {
Expand All @@ -46,6 +45,6 @@ describe('MapToolTip', () => {
loadFeatureGeometry={loadFeatureGeometry}
/>
);
expect(toJson(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import React from 'react';
import { FeatureProperty } from '../types';
import { getRenderedFieldValue, PointToolTipContentComponent } from './point_tool_tip_content';
Expand Down Expand Up @@ -49,7 +48,7 @@ describe('PointToolTipContent', () => {
/>
</TestProviders>
);
expect(toJson(wrapper.find('PointToolTipContentComponent'))).toMatchSnapshot();
expect(wrapper.find('PointToolTipContentComponent')).toMatchSnapshot();
});

test('renders array filter correctly', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { mount, shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import React from 'react';
import { ToolTipFooterComponent } from './tooltip_footer';

Expand All @@ -27,7 +26,7 @@ describe('ToolTipFilter', () => {
totalFeatures={100}
/>
);
expect(toJson(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});

describe('Lower bounds', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import React from 'react';

import { EmptyPage } from './index';
Expand All @@ -18,5 +17,5 @@ test('renders correctly', () => {
title="My Super Title"
/>
);
expect(toJson(EmptyComponent)).toMatchSnapshot();
expect(EmptyComponent).toMatchSnapshot();
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json';
import { mount, shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import React from 'react';
import { ThemeProvider } from 'styled-components';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
Expand All @@ -25,7 +24,7 @@ describe('EmptyValue', () => {

test('it renders against snapshot', () => {
const wrapper = shallow(<p>{getEmptyString()}</p>);
expect(toJson(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});

describe('#getEmptyValue', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import React from 'react';
import { Provider } from 'react-redux';

Expand All @@ -30,7 +29,7 @@ describe('Error Toast Dispatcher', () => {
<ErrorToastDispatcher toastLifeTimeMs={9999999999} />
</Provider>
);
expect(toJson(wrapper.find('Connect(ErrorToastDispatcherComponent)'))).toMatchSnapshot();
expect(wrapper.find('Connect(ErrorToastDispatcherComponent)')).toMatchSnapshot();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import React from 'react';

import { mockDetailItemData, mockDetailItemDataId } from '../../mock/mock_detail_item';
Expand Down Expand Up @@ -34,7 +33,7 @@ describe('EventDetails', () => {
toggleColumn={jest.fn()}
/>
);
expect(toJson(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});
});

Expand Down
Loading

0 comments on commit 8eb000d

Please sign in to comment.