PluginActionBar.test.tsx 758 B

12345678910111213141516171819202122232425262728293031
  1. import React from 'react';
  2. import { shallow } from 'enzyme';
  3. import { PluginActionBar, Props } from './PluginActionBar';
  4. import { LayoutModes } from '../../core/components/LayoutSelector/LayoutSelector';
  5. const setup = (propOverrides?: object) => {
  6. const props: Props = {
  7. searchQuery: '',
  8. layoutMode: LayoutModes.Grid,
  9. setLayoutMode: jest.fn(),
  10. setPluginsSearchQuery: jest.fn(),
  11. };
  12. Object.assign(props, propOverrides);
  13. const wrapper = shallow(<PluginActionBar {...props} />);
  14. const instance = wrapper.instance() as PluginActionBar;
  15. return {
  16. wrapper,
  17. instance,
  18. };
  19. };
  20. describe('Render', () => {
  21. it('should render component', () => {
  22. const { wrapper } = setup();
  23. expect(wrapper).toMatchSnapshot();
  24. });
  25. });