settings.spec.tsx 1.6 KB

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