inactivePlugins.spec.jsx 935 B

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