import {Fragment} from 'react'; import {render, screen} from 'sentry-test/reactTestingLibrary'; import {Client} from 'sentry/api'; import TraceLiteQuery from 'sentry/utils/performance/quickTrace/traceLiteQuery'; const traceId = 'abcdef1234567890'; const eventId = '0987654321fedcba'; function renderTraceLite({isLoading, error, trace, type}) { if (isLoading) { return 'loading'; } if (error !== null) { return error; } return (
{type}
{trace.length}
); } describe('TraceLiteQuery', function () { let api, location; beforeEach(function () { api = new Client(); location = { pathname: '/', query: {}, }; }); it('fetches data on mount and passes the event id', async function () { const getMock = MockApiClient.addMockResponse({ url: `/organizations/test-org/events-trace-light/${traceId}/`, body: [], match: [MockApiClient.matchQuery({event_id: eventId})], }); render( {renderTraceLite} ); expect(await screen.findByText('partial')).toBeInTheDocument(); expect(getMock).toHaveBeenCalledTimes(1); }); });