profileEventEvidence.spec.tsx 2.2 KB

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