index.spec.tsx 3.4 KB

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