inactivePlugins.spec.jsx 980 B

12345678910111213141516171819202122232425262728293031323334
  1. import React from 'react';
  2. import {mountWithTheme} 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 = mountWithTheme(
  7. <InactivePlugins plugins={[]} onEnablePlugin={() => {}} />
  8. );
  9. expect(wrapper).toSnapshot();
  10. });
  11. it('renders plugins list', function() {
  12. const wrapper = mountWithTheme(
  13. <InactivePlugins onEnablePlugin={() => {}} plugins={TestStubs.Plugins()} />
  14. );
  15. expect(wrapper).toSnapshot();
  16. });
  17. it('enables a plugin', function() {
  18. const enableFn = jest.fn();
  19. const plugins = TestStubs.Plugins();
  20. const wrapper = mountWithTheme(
  21. <InactivePlugins onEnablePlugin={enableFn} plugins={plugins} />
  22. );
  23. wrapper
  24. .find('button')
  25. .first()
  26. .simulate('click');
  27. expect(enableFn).toHaveBeenCalledWith(expect.objectContaining(plugins[0]));
  28. });
  29. });