inactivePlugins.spec.tsx 924 B

1234567891011121314151617181920212223242526
  1. import {Plugins} from 'sentry-fixture/plugins';
  2. import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
  3. import InactivePlugins from 'sentry/components/inactivePlugins';
  4. describe('InactivePlugins', function () {
  5. it('renders null when no plugins', function () {
  6. const {container} = render(
  7. <InactivePlugins plugins={[]} onEnablePlugin={() => {}} />
  8. );
  9. expect(container).toBeEmptyDOMElement();
  10. });
  11. it('renders plugins list', function () {
  12. render(<InactivePlugins onEnablePlugin={() => {}} plugins={Plugins()} />);
  13. });
  14. it('enables a plugin', async function () {
  15. const enableFn = jest.fn();
  16. const plugins = Plugins();
  17. render(<InactivePlugins onEnablePlugin={enableFn} plugins={plugins} />);
  18. await userEvent.click(screen.getByRole('button', {name: plugins[0].name}));
  19. expect(enableFn).toHaveBeenCalledWith(expect.objectContaining(plugins[0]));
  20. });
  21. });