inactivePlugins.spec.jsx 925 B

12345678910111213141516171819202122232425262728
  1. import React from 'react';
  2. import {mount, shallow} from 'enzyme';
  3. import InactivePlugins from 'app/components/inactivePlugins';
  4. describe('InactivePlugins', function() {
  5. it('renders null when no plugins', function() {
  6. let wrapper = shallow(<InactivePlugins plugins={[]} onEnablePlugin={() => {}} />);
  7. expect(wrapper).toMatchSnapshot();
  8. });
  9. it('renders plugins list', function() {
  10. let wrapper = shallow(
  11. <InactivePlugins onEnablePlugin={() => {}} plugins={TestStubs.Plugins()} />
  12. );
  13. expect(wrapper).toMatchSnapshot();
  14. });
  15. it('enables a plugin', function() {
  16. let enableFn = jest.fn();
  17. let plugins = TestStubs.Plugins();
  18. let wrapper = mount(<InactivePlugins onEnablePlugin={enableFn} plugins={plugins} />);
  19. wrapper
  20. .find('button')
  21. .first()
  22. .simulate('click');
  23. expect(enableFn).toHaveBeenCalledWith(expect.objectContaining(plugins[0]), true);
  24. });
  25. });