index.spec.tsx 3.2 KB

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