groupDetailsLayout.spec.tsx 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. import {EventFixture} from 'sentry-fixture/event';
  2. import {EventsStatsFixture} from 'sentry-fixture/events';
  3. import {GroupFixture} from 'sentry-fixture/group';
  4. import {OrganizationFixture} from 'sentry-fixture/organization';
  5. import {ProjectFixture} from 'sentry-fixture/project';
  6. import {TagsFixture} from 'sentry-fixture/tags';
  7. import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
  8. import ProjectsStore from 'sentry/stores/projectsStore';
  9. import {ReprocessingStatus} from 'sentry/views/issueDetails/utils';
  10. import {GroupDetailsLayout} from './groupDetailsLayout';
  11. describe('GroupDetailsLayout', () => {
  12. const organization = OrganizationFixture();
  13. const group = GroupFixture();
  14. const event = EventFixture();
  15. const project = ProjectFixture();
  16. beforeEach(() => {
  17. ProjectsStore.init();
  18. ProjectsStore.loadInitialData([project]);
  19. MockApiClient.addMockResponse({
  20. url: `/organizations/${organization.slug}/issues/${group.id}/`,
  21. method: 'GET',
  22. body: group,
  23. });
  24. MockApiClient.addMockResponse({
  25. url: '/organizations/org-slug/replay-count/',
  26. body: {},
  27. });
  28. MockApiClient.addMockResponse({
  29. url: `/organizations/org-slug/repos/`,
  30. body: {},
  31. });
  32. MockApiClient.addMockResponse({
  33. url: `/organizations/${organization.slug}/releases/stats/`,
  34. body: [],
  35. });
  36. MockApiClient.addMockResponse({
  37. url: `/organizations/${organization.slug}/issues/${group.id}/attachments/`,
  38. body: [],
  39. });
  40. MockApiClient.addMockResponse({
  41. url: `/organizations/${organization.slug}/users/`,
  42. body: [],
  43. });
  44. MockApiClient.addMockResponse({
  45. url: `/organizations/${organization.slug}/issues/${group.id}/first-last-release/`,
  46. });
  47. MockApiClient.addMockResponse({
  48. url: `/organizations/${organization.slug}/issues/${group.id}/external-issues/`,
  49. body: [],
  50. });
  51. MockApiClient.addMockResponse({
  52. url: `/organizations/${organization.slug}/issues/${group.id}/integrations/`,
  53. body: [],
  54. });
  55. MockApiClient.addMockResponse({
  56. url: `/organizations/${organization.slug}/events-stats/`,
  57. body: {'count()': EventsStatsFixture(), 'count_unique(user)': EventsStatsFixture()},
  58. });
  59. MockApiClient.addMockResponse({
  60. url: `/organizations/${organization.slug}/events/`,
  61. body: {data: [{'count_unique(user)': 21}]},
  62. });
  63. MockApiClient.addMockResponse({
  64. url: `/projects/${organization.slug}/${project.slug}/events/${event.id}/owners/`,
  65. body: {owners: [], rules: []},
  66. });
  67. MockApiClient.addMockResponse({
  68. url: `/organizations/${organization.slug}/issues/${group.id}/tags/`,
  69. body: TagsFixture(),
  70. });
  71. MockApiClient.addMockResponse({
  72. url: '/projects/org-slug/project-slug/events/1/committers/',
  73. body: {committers: []},
  74. });
  75. MockApiClient.addMockResponse({
  76. url: '/issues/1/autofix/setup/',
  77. body: {
  78. genAIConsent: {ok: false},
  79. integration: {ok: true},
  80. githubWriteIntegration: {ok: true},
  81. },
  82. });
  83. });
  84. it('renders children, can collapse sidebar', async () => {
  85. render(
  86. <GroupDetailsLayout
  87. group={group}
  88. event={event}
  89. project={project}
  90. groupReprocessingStatus={ReprocessingStatus.NO_STATUS}
  91. >
  92. <div data-test-id="children" />
  93. </GroupDetailsLayout>
  94. );
  95. expect(await screen.findByTestId('children')).toBeInTheDocument();
  96. expect(
  97. await screen.findByText('Track this issue in Jira, GitHub, etc.')
  98. ).toBeInTheDocument();
  99. await userEvent.click(screen.getByRole('button', {name: 'Close sidebar'}));
  100. expect(await screen.findByTestId('children')).toBeInTheDocument();
  101. expect(
  102. screen.queryByText('Track this issue in Jira, GitHub, etc.')
  103. ).not.toBeInTheDocument();
  104. });
  105. });