import {OrganizationFixture} from 'sentry-fixture/organization'; import {PageFiltersFixture} from 'sentry-fixture/pageFilters'; import {WidgetFixture} from 'sentry-fixture/widget'; import {render, screen} from 'sentry-test/reactTestingLibrary'; import SpansWidgetQueries from './spansWidgetQueries'; describe('spansWidgetQueries', () => { const api = new MockApiClient(); const organization = OrganizationFixture(); let widget = WidgetFixture(); const selection = PageFiltersFixture(); beforeEach(() => { MockApiClient.clearMockResponses(); widget = WidgetFixture(); }); it('calculates the confidence for a single series', async () => { MockApiClient.addMockResponse({ url: '/organizations/org-slug/events-stats/', body: { confidence: [ [1, [{count: 'low'}]], [2, [{count: 'low'}]], [3, [{count: 'low'}]], ], data: [], }, }); render( {({confidence}) =>
{confidence}
}
); expect(await screen.findByText('low')).toBeInTheDocument(); }); it('calculates the confidence for a multi series', async () => { widget = WidgetFixture({ queries: [ { name: '', aggregates: ['a', 'b'], fields: ['a', 'b'], columns: [], conditions: '', orderby: '', }, ], }); MockApiClient.addMockResponse({ url: '/organizations/org-slug/events-stats/', body: { a: { confidence: [ [1, [{count: 'high'}]], [2, [{count: 'high'}]], [3, [{count: 'high'}]], ], data: [], }, b: { confidence: [ [1, [{count: 'high'}]], [2, [{count: 'high'}]], [3, [{count: 'high'}]], ], data: [], }, }, }); render( {({confidence}) =>
{confidence}
}
); expect(await screen.findByText('high')).toBeInTheDocument(); }); });