inactivePlugins.spec.jsx 959 B

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