sampleDrawerHeaderTransaction.spec.tsx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import {ProjectFixture} from 'sentry-fixture/project';
  2. import {render, screen} from 'sentry-test/reactTestingLibrary';
  3. import {textWithMarkupMatcher} from 'sentry-test/utils';
  4. import {SampleDrawerHeaderTransaction} from './sampleDrawerHeaderTransaction';
  5. describe('SampleDrawerHeaderTransaction', () => {
  6. it('Links to the transaction summary page', () => {
  7. const project = ProjectFixture();
  8. render(<SampleDrawerHeaderTransaction project={project} transaction="/issues" />);
  9. const $link = screen.getByRole('link');
  10. expect($link).toHaveAccessibleName('/issues');
  11. expect($link).toHaveAttribute(
  12. 'href',
  13. '/organizations/org-slug/performance/summary?project=project-slug&transaction=%2Fissues'
  14. );
  15. });
  16. it('Shows transaction method', () => {
  17. const project = ProjectFixture();
  18. render(
  19. <SampleDrawerHeaderTransaction
  20. project={project}
  21. transaction="/issues"
  22. transactionMethod="GET"
  23. />
  24. );
  25. const $link = screen.getByRole('link');
  26. expect($link).toHaveAccessibleName('GET /issues');
  27. });
  28. it('Strips duplicate transaction method', () => {
  29. const project = ProjectFixture();
  30. render(
  31. <SampleDrawerHeaderTransaction
  32. project={project}
  33. transaction="GET /issues"
  34. transactionMethod="GET"
  35. />
  36. );
  37. const $link = screen.getByRole('link');
  38. expect($link).toHaveAccessibleName('GET /issues');
  39. });
  40. it('Shows a prefix', () => {
  41. const project = ProjectFixture();
  42. render(
  43. <SampleDrawerHeaderTransaction
  44. project={project}
  45. transaction="tasks.deliver_mail"
  46. subtitle="Producer"
  47. />
  48. );
  49. expect(
  50. screen.getByText(textWithMarkupMatcher('Producer:tasks.deliver_mail'))
  51. ).toBeInTheDocument();
  52. });
  53. });