settings.spec.tsx 1.6 KB

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