groupDetailsLayout.spec.tsx 3.6 KB

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