PluginListPage.test.tsx 816 B

1234567891011121314151617181920212223242526272829303132
  1. import React from 'react';
  2. import { shallow } from 'enzyme';
  3. import { PluginListPage, Props } from './PluginListPage';
  4. import { NavModel, PluginListItem } 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 PluginListItem[],
  10. layoutMode: LayoutModes.Grid,
  11. loadPlugins: jest.fn(),
  12. };
  13. Object.assign(props, propOverrides);
  14. const wrapper = shallow(<PluginListPage {...props} />);
  15. const instance = wrapper.instance() as PluginListPage;
  16. return {
  17. wrapper,
  18. instance,
  19. };
  20. };
  21. describe('Render', () => {
  22. it('should render component', () => {
  23. const { wrapper } = setup();
  24. expect(wrapper).toMatchSnapshot();
  25. });
  26. });