breadcrumb.spec.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import {initializeOrg} from 'sentry-test/initializeOrg';
  2. import {render, screen} from 'sentry-test/reactTestingLibrary';
  3. import {Breadcrumb} from 'sentry/components/profiling/breadcrumb';
  4. describe('Breadcrumb', function () {
  5. let location, organization;
  6. beforeEach(function () {
  7. location = TestStubs.location();
  8. const context = initializeOrg();
  9. organization = context.organization;
  10. });
  11. it('renders the profiling link', function () {
  12. render(
  13. <Breadcrumb
  14. location={location}
  15. organization={organization}
  16. trails={[
  17. {type: 'landing'},
  18. {
  19. type: 'flamechart',
  20. payload: {
  21. transaction: 'foo',
  22. profileId: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
  23. projectSlug: 'bar',
  24. tab: 'flamechart',
  25. },
  26. },
  27. ]}
  28. />
  29. );
  30. expect(screen.getByText('Profiling')).toBeInTheDocument();
  31. expect(screen.getByRole('link', {name: 'Profiling'})).toHaveAttribute(
  32. 'href',
  33. `/organizations/${organization.slug}/profiling/`
  34. );
  35. expect(screen.getByText('foo')).toBeInTheDocument();
  36. });
  37. });