PluginListPage.test.tsx 896 B

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