projectPlugins.spec.tsx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import {PluginsFixture} from 'sentry-fixture/plugins';
  2. import {initializeOrg} from 'sentry-test/initializeOrg';
  3. import {render, screen, waitFor} from 'sentry-test/reactTestingLibrary';
  4. import ProjectPlugins from 'sentry/views/settings/projectPlugins/projectPlugins';
  5. describe('ProjectPlugins', function () {
  6. it('renders', async function () {
  7. const {organization, routerProps, project} = initializeOrg();
  8. render(
  9. <ProjectPlugins
  10. {...routerProps}
  11. organization={organization}
  12. params={{
  13. orgId: organization.slug,
  14. }}
  15. project={project}
  16. onChange={jest.fn()}
  17. loading={false}
  18. error={undefined}
  19. plugins={PluginsFixture()}
  20. />
  21. );
  22. await waitFor(() =>
  23. expect(screen.queryByTestId('loading-indicator')).not.toBeInTheDocument()
  24. );
  25. });
  26. it('has error state when plugins=[]', async function () {
  27. const {organization, routerProps, project} = initializeOrg();
  28. render(
  29. <ProjectPlugins
  30. {...routerProps}
  31. organization={organization}
  32. params={{
  33. orgId: organization.slug,
  34. }}
  35. project={project}
  36. onChange={jest.fn()}
  37. loading={false}
  38. error={new Error('An error')}
  39. plugins={[]}
  40. />
  41. );
  42. expect(await screen.findByText('Oops! Something went wrong')).toBeInTheDocument();
  43. });
  44. });