profileEventEvidence.spec.tsx 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import {Event as EventFixture} from 'sentry-fixture/event';
  2. import {render, screen} from 'sentry-test/reactTestingLibrary';
  3. import {ProfileEventEvidence} from 'sentry/components/events/profileEventEvidence';
  4. import {IssueCategory, IssueType} from 'sentry/types';
  5. describe('ProfileEventEvidence', function () {
  6. const defaultProps = {
  7. event: EventFixture({
  8. id: 'event-id',
  9. occurrence: {
  10. evidenceDisplay: [{name: 'Evidence name', value: 'Evidence value'}],
  11. evidenceData: {
  12. profileId: 'profile-id',
  13. frameName: 'some_func',
  14. framePackage: 'something.dll',
  15. transactionId: 'transaction-id',
  16. transactionName: 'SomeTransaction',
  17. },
  18. },
  19. }),
  20. group: TestStubs.Group({
  21. issueCategory: IssueCategory.PROFILE,
  22. issueType: IssueType.PROFILE_FILE_IO_MAIN_THREAD,
  23. }),
  24. projectSlug: 'project-slug',
  25. };
  26. it('displays profile ID and data in evidence display', function () {
  27. render(<ProfileEventEvidence {...defaultProps} />);
  28. expect(screen.getByRole('cell', {name: 'Transaction Name'})).toBeInTheDocument();
  29. expect(screen.getByRole('cell', {name: /SomeTransaction/})).toBeInTheDocument();
  30. expect(screen.getByRole('cell', {name: 'Profile ID'})).toBeInTheDocument();
  31. expect(screen.getByRole('cell', {name: /profile-id/})).toBeInTheDocument();
  32. expect(screen.getByRole('cell', {name: 'Evidence name'})).toBeInTheDocument();
  33. expect(screen.getByRole('cell', {name: 'Evidence value'})).toBeInTheDocument();
  34. });
  35. it('correctly links to the profile frame', function () {
  36. render(<ProfileEventEvidence {...defaultProps} />);
  37. expect(screen.getByRole('button', {name: 'View Profile'})).toHaveAttribute(
  38. 'href',
  39. '/organizations/org-slug/profiling/profile/project-slug/profile-id/flamegraph/?frameName=some_func&framePackage=something.dll&referrer=issue'
  40. );
  41. });
  42. it('correctly links to the transaction', function () {
  43. render(<ProfileEventEvidence {...defaultProps} />);
  44. expect(screen.getByRole('button', {name: 'View Transaction'})).toHaveAttribute(
  45. 'href',
  46. '/organizations/org-slug/performance/project-slug:transaction-id/?referrer=issue'
  47. );
  48. });
  49. });