spanOpsQuery.spec.tsx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import {render} from 'sentry-test/reactTestingLibrary';
  2. import EventView from 'sentry/utils/discover/eventView';
  3. import SpanOpsQuery from 'sentry/utils/performance/suspectSpans/spanOpsQuery';
  4. import {
  5. SpanSortOthers,
  6. SpanSortPercentiles,
  7. } from 'sentry/views/performance/transactionSummary/transactionSpans/types';
  8. describe('SuspectSpansQuery', function () {
  9. let eventView, location;
  10. beforeEach(function () {
  11. eventView = EventView.fromSavedQuery({
  12. id: '',
  13. name: '',
  14. version: 2,
  15. fields: [...Object.values(SpanSortOthers), ...Object.values(SpanSortPercentiles)],
  16. projects: [],
  17. environment: [],
  18. });
  19. location = {
  20. pathname: '/',
  21. query: {},
  22. };
  23. });
  24. it('fetches data on mount', function () {
  25. const getMock = MockApiClient.addMockResponse({
  26. url: '/organizations/test-org/events-span-ops/',
  27. // just asserting that the data is being fetched, no need for actual data here
  28. body: [],
  29. });
  30. render(
  31. <SpanOpsQuery location={location} orgSlug="test-org" eventView={eventView}>
  32. {() => null}
  33. </SpanOpsQuery>
  34. );
  35. expect(getMock).toHaveBeenCalledTimes(1);
  36. });
  37. });