groupDetailsLayout.spec.tsx 3.7 KB

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