PluginListItem.test.tsx 739 B

123456789101112131415161718192021222324252627282930313233
  1. import React from 'react';
  2. import { shallow } from 'enzyme';
  3. import PluginListItem from './PluginListItem';
  4. import { getMockPlugin } from './__mocks__/pluginMocks';
  5. const setup = (propOverrides?: object) => {
  6. const props = Object.assign(
  7. {
  8. plugin: getMockPlugin(),
  9. },
  10. propOverrides
  11. );
  12. return shallow(<PluginListItem {...props} />);
  13. };
  14. describe('Render', () => {
  15. it('should render component', () => {
  16. const wrapper = setup();
  17. expect(wrapper).toMatchSnapshot();
  18. });
  19. it('should render has plugin section', () => {
  20. const mockPlugin = getMockPlugin();
  21. mockPlugin.hasUpdate = true;
  22. const wrapper = setup({
  23. plugin: mockPlugin,
  24. });
  25. expect(wrapper).toMatchSnapshot();
  26. });
  27. });