index.spec.tsx 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. // @ts-ignore no-console
  14. // eslint-disable-next-line no-console
  15. jest.spyOn(console, 'error').mockImplementation(jest.fn());
  16. MockApiClient.addMockResponse({
  17. url: '/organizations/org-slug/sdk-updates/',
  18. body: [],
  19. });
  20. MockApiClient.addMockResponse({
  21. url: '/prompts-activity/',
  22. body: {},
  23. });
  24. });
  25. describe('project low priority queue alert', function () {
  26. it('does not render alert', function () {
  27. const projects = [
  28. {
  29. ...project,
  30. eventProcessing: {
  31. symbolicationDegraded: false,
  32. },
  33. },
  34. ];
  35. MockApiClient.addMockResponse({
  36. url: '/organizations/org-slug/projects/',
  37. body: projects,
  38. });
  39. MockApiClient.addMockResponse({
  40. url: '/projects/org-slug/project-slug/',
  41. body: projects[0],
  42. });
  43. ProjectsStore.loadInitialData(projects);
  44. render(
  45. <ProjectDetails
  46. organization={organization}
  47. router={router}
  48. location={router.location}
  49. params={params}
  50. routes={router.routes}
  51. routeParams={router.params}
  52. route={{}}
  53. />,
  54. {
  55. context: routerContext,
  56. organization,
  57. }
  58. );
  59. expect(
  60. screen.queryByText(
  61. 'Event Processing for this project is currently degraded. Events may appear with larger delays than usual or get dropped.',
  62. {exact: false}
  63. )
  64. ).not.toBeInTheDocument();
  65. });
  66. it('renders alert', async function () {
  67. const projects = [
  68. {
  69. ...project,
  70. eventProcessing: {
  71. symbolicationDegraded: true,
  72. },
  73. },
  74. ];
  75. ProjectsStore.loadInitialData(projects);
  76. MockApiClient.addMockResponse({
  77. url: '/organizations/org-slug/projects/',
  78. body: projects,
  79. });
  80. MockApiClient.addMockResponse({
  81. url: '/projects/org-slug/project-slug/',
  82. body: projects[0],
  83. });
  84. render(
  85. <ProjectDetails
  86. organization={organization}
  87. router={router}
  88. location={router.location}
  89. params={params}
  90. routes={router.routes}
  91. routeParams={router.params}
  92. route={{}}
  93. />,
  94. {
  95. context: routerContext,
  96. organization,
  97. }
  98. );
  99. expect(
  100. await screen.findByText(
  101. textWithMarkupMatcher(
  102. '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.'
  103. )
  104. )
  105. ).toBeInTheDocument();
  106. });
  107. });
  108. });