profileEventEvidence.spec.tsx 2.1 KB

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