settings.spec.tsx 1.5 KB

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