index.spec.tsx 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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};
  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(<ProjectDetails organization={organization} {...router} params={params} />, {
  45. context: routerContext,
  46. organization,
  47. });
  48. expect(
  49. screen.queryByText(
  50. 'Event Processing for this project is currently degraded. Events may appear with larger delays than usual or get dropped.',
  51. {exact: false}
  52. )
  53. ).not.toBeInTheDocument();
  54. });
  55. it('renders alert', async function () {
  56. const projects = [
  57. {
  58. ...project,
  59. eventProcessing: {
  60. symbolicationDegraded: true,
  61. },
  62. },
  63. ];
  64. ProjectsStore.loadInitialData(projects);
  65. MockApiClient.addMockResponse({
  66. url: '/organizations/org-slug/projects/',
  67. body: projects,
  68. });
  69. MockApiClient.addMockResponse({
  70. url: '/projects/org-slug/project-slug/',
  71. body: projects[0],
  72. });
  73. render(<ProjectDetails organization={organization} {...router} params={params} />, {
  74. context: routerContext,
  75. organization,
  76. });
  77. expect(
  78. await screen.findByText(
  79. textWithMarkupMatcher(
  80. '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.'
  81. )
  82. )
  83. ).toBeInTheDocument();
  84. });
  85. });
  86. });