settings.spec.tsx 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import {Organization} from 'sentry-fixture/organization';
  2. import {Project as ProjectFixture} from 'sentry-fixture/project';
  3. import RouterFixture from 'sentry-fixture/routerFixture';
  4. import {render, screen} from 'sentry-test/reactTestingLibrary';
  5. import Settings from 'sentry/views/settings/projectAlerts/settings';
  6. describe('ProjectAlertSettings', () => {
  7. const router = RouterFixture();
  8. const organization = Organization();
  9. // 12 minutes
  10. const digestsMinDelay = 12 * 60;
  11. // 55 minutes
  12. const digestsMaxDelay = 55 * 60;
  13. const project = ProjectFixture({
  14. digestsMinDelay,
  15. digestsMaxDelay,
  16. });
  17. beforeEach(() => {
  18. MockApiClient.addMockResponse({
  19. url: `/projects/${organization.slug}/${project.slug}/`,
  20. method: 'GET',
  21. body: project,
  22. });
  23. MockApiClient.addMockResponse({
  24. url: `/projects/${organization.slug}/${project.slug}/plugins/`,
  25. method: 'GET',
  26. body: [],
  27. });
  28. });
  29. it('renders', () => {
  30. render(
  31. <Settings
  32. canEditRule
  33. params={{projectId: project.slug}}
  34. organization={organization}
  35. routes={[]}
  36. router={router}
  37. routeParams={router.params}
  38. route={router.routes[0]}
  39. location={router.location}
  40. />
  41. );
  42. expect(screen.getByPlaceholderText('e.g. $shortID - $title')).toBeInTheDocument();
  43. expect(
  44. screen.getByRole('slider', {name: 'Minimum delivery interval'})
  45. ).toBeInTheDocument();
  46. expect(
  47. screen.getByRole('slider', {name: 'Maximum delivery interval'})
  48. ).toBeInTheDocument();
  49. expect(
  50. screen.getByText(
  51. "Oops! Looks like there aren't any available integrations installed."
  52. )
  53. ).toBeInTheDocument();
  54. });
  55. });