PluginListPage.test.tsx 947 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. hasFetched: false,
  16. };
  17. Object.assign(props, propOverrides);
  18. return shallow(<PluginListPage {...props} />);
  19. };
  20. describe('Render', () => {
  21. it('should render component', () => {
  22. const wrapper = setup();
  23. expect(wrapper).toMatchSnapshot();
  24. });
  25. it('should render list', () => {
  26. const wrapper = setup({
  27. hasFetched: true,
  28. });
  29. expect(wrapper).toMatchSnapshot();
  30. });
  31. });