projectPlugins.spec.tsx 1.3 KB

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