mergedIssuesDrawer.spec.tsx 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import {EventFixture} from 'sentry-fixture/event';
  2. import {GroupFixture} from 'sentry-fixture/group';
  3. import {OrganizationFixture} from 'sentry-fixture/organization';
  4. import {ProjectFixture} from 'sentry-fixture/project';
  5. import {render, screen} from 'sentry-test/reactTestingLibrary';
  6. import GroupStore from 'sentry/stores/groupStore';
  7. import ProjectsStore from 'sentry/stores/projectsStore';
  8. import {MergedIssuesDrawer} from 'sentry/views/issueDetails/groupMerged/mergedIssuesDrawer';
  9. describe('MergedIssuesDrawer', function () {
  10. const organization = OrganizationFixture();
  11. const project = ProjectFixture();
  12. const group = GroupFixture();
  13. const event = EventFixture();
  14. let mockMergedIssues: jest.Mock;
  15. beforeEach(function () {
  16. MockApiClient.clearMockResponses();
  17. ProjectsStore.loadInitialData([project]);
  18. GroupStore.init();
  19. mockMergedIssues = MockApiClient.addMockResponse({
  20. url: `/organizations/${organization.slug}/issues/${group.id}/hashes/?limit=50&query=`,
  21. body: [
  22. {
  23. latestEvent: event,
  24. state: 'unlocked',
  25. id: '2c4887696f708c476a81ce4e834c4b02',
  26. },
  27. ],
  28. method: 'GET',
  29. });
  30. });
  31. it('renders the content as expected', async function () {
  32. render(<MergedIssuesDrawer group={group} project={project} />, {organization});
  33. expect(
  34. await screen.findByRole('heading', {name: 'Merged Issues'})
  35. ).toBeInTheDocument();
  36. expect(screen.getByText('Fingerprints included in this issue')).toBeInTheDocument();
  37. expect(mockMergedIssues).toHaveBeenCalled();
  38. expect(screen.getByRole('button', {name: 'Close Drawer'})).toBeInTheDocument();
  39. });
  40. });