index.spec.tsx 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. import {initializeOrg} from 'sentry-test/initializeOrg';
  2. import {render, screen} from 'sentry-test/reactTestingLibrary';
  3. import {textWithMarkupMatcher} from 'sentry-test/utils';
  4. import PageFiltersStore from 'sentry/stores/pageFiltersStore';
  5. import ProjectsStore from 'sentry/stores/projectsStore';
  6. import ProjectDetails from 'sentry/views/projectDetail/projectDetail';
  7. describe('ProjectDetail', function () {
  8. const {routerContext, organization, project, router} = initializeOrg();
  9. const params = {...router.params, projectId: project.slug} as any;
  10. beforeEach(() => {
  11. PageFiltersStore.reset();
  12. ProjectsStore.reset();
  13. // eslint-disable-next-line no-console
  14. jest.spyOn(console, 'error').mockImplementation(jest.fn());
  15. MockApiClient.addMockResponse({
  16. url: '/organizations/org-slug/sdk-updates/',
  17. body: [],
  18. });
  19. MockApiClient.addMockResponse({
  20. url: '/prompts-activity/',
  21. body: {},
  22. });
  23. });
  24. describe('project low priority queue alert', function () {
  25. it('does not render alert', function () {
  26. const projects = [
  27. {
  28. ...project,
  29. eventProcessing: {
  30. symbolicationDegraded: false,
  31. },
  32. },
  33. ];
  34. MockApiClient.addMockResponse({
  35. url: '/organizations/org-slug/projects/',
  36. body: projects,
  37. });
  38. MockApiClient.addMockResponse({
  39. url: '/projects/org-slug/project-slug/',
  40. body: projects[0],
  41. });
  42. ProjectsStore.loadInitialData(projects);
  43. render(
  44. <ProjectDetails
  45. organization={organization}
  46. router={router}
  47. location={router.location}
  48. params={params}
  49. routes={router.routes}
  50. routeParams={router.params}
  51. route={{}}
  52. />,
  53. {
  54. context: routerContext,
  55. organization,
  56. }
  57. );
  58. expect(
  59. screen.queryByText(
  60. 'Event Processing for this project is currently degraded. Events may appear with larger delays than usual or get dropped.',
  61. {exact: false}
  62. )
  63. ).not.toBeInTheDocument();
  64. });
  65. it('renders alert', async function () {
  66. const projects = [
  67. {
  68. ...project,
  69. eventProcessing: {
  70. symbolicationDegraded: true,
  71. },
  72. },
  73. ];
  74. ProjectsStore.loadInitialData(projects);
  75. MockApiClient.addMockResponse({
  76. url: '/organizations/org-slug/projects/',
  77. body: projects,
  78. });
  79. MockApiClient.addMockResponse({
  80. url: '/projects/org-slug/project-slug/',
  81. body: projects[0],
  82. });
  83. render(
  84. <ProjectDetails
  85. organization={organization}
  86. router={router}
  87. location={router.location}
  88. params={params}
  89. routes={router.routes}
  90. routeParams={router.params}
  91. route={{}}
  92. />,
  93. {
  94. context: routerContext,
  95. organization,
  96. }
  97. );
  98. expect(
  99. await screen.findByText(
  100. textWithMarkupMatcher(
  101. 'Event Processing for this project is currently degraded. Events may appear with larger delays than usual or get dropped. Please check the Status page for a potential outage.'
  102. )
  103. )
  104. ).toBeInTheDocument();
  105. });
  106. });
  107. });