import {Fragment} from 'react'; import {mountWithTheme} from 'sentry-test/enzyme'; 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})], }); const wrapper = mountWithTheme( {renderTraceLite} ); await tick(); wrapper.update(); expect(getMock).toHaveBeenCalledTimes(1); expect(wrapper.find('div[data-test-id="type"]').text()).toEqual('partial'); }); });