|
@@ -2,17 +2,20 @@ import {ProjectFixture} from 'sentry-fixture/project';
|
|
|
|
|
|
import {addMetricsDataMock} from 'sentry-test/performance/addMetricsDataMock';
|
|
|
import {initializeData} from 'sentry-test/performance/initializePerformanceData';
|
|
|
-import {makeTestQueryClient} from 'sentry-test/queryClient';
|
|
|
import {act, render, screen} from 'sentry-test/reactTestingLibrary';
|
|
|
|
|
|
import TeamStore from 'sentry/stores/teamStore';
|
|
|
import {MetricsCardinalityProvider} from 'sentry/utils/performance/contexts/metricsCardinality';
|
|
|
-import {QueryClientProvider} from 'sentry/utils/queryClient';
|
|
|
-import {OrganizationContext} from 'sentry/views/organizationContext';
|
|
|
import {generatePerformanceEventView} from 'sentry/views/performance/data';
|
|
|
import {PerformanceLanding} from 'sentry/views/performance/landing';
|
|
|
|
|
|
-function WrappedComponent({data, withStaticFilters = true}) {
|
|
|
+function WrappedComponent({
|
|
|
+ data,
|
|
|
+ withStaticFilters = true,
|
|
|
+}: {
|
|
|
+ data: any;
|
|
|
+ withStaticFilters?: boolean;
|
|
|
+}) {
|
|
|
const eventView = generatePerformanceEventView(
|
|
|
data.router.location,
|
|
|
data.projects,
|
|
@@ -23,28 +26,24 @@ function WrappedComponent({data, withStaticFilters = true}) {
|
|
|
);
|
|
|
|
|
|
return (
|
|
|
- <QueryClientProvider client={makeTestQueryClient()}>
|
|
|
- <OrganizationContext.Provider value={data.organization}>
|
|
|
- <MetricsCardinalityProvider
|
|
|
- location={data.router.location}
|
|
|
- organization={data.organization}
|
|
|
- >
|
|
|
- <PerformanceLanding
|
|
|
- router={data.router}
|
|
|
- organization={data.organization}
|
|
|
- location={data.router.location}
|
|
|
- eventView={eventView}
|
|
|
- projects={data.projects}
|
|
|
- selection={eventView.getPageFilters()}
|
|
|
- onboardingProject={undefined}
|
|
|
- handleSearch={() => {}}
|
|
|
- handleTrendsClick={() => {}}
|
|
|
- setError={() => {}}
|
|
|
- withStaticFilters={withStaticFilters}
|
|
|
- />
|
|
|
- </MetricsCardinalityProvider>
|
|
|
- </OrganizationContext.Provider>
|
|
|
- </QueryClientProvider>
|
|
|
+ <MetricsCardinalityProvider
|
|
|
+ location={data.router.location}
|
|
|
+ organization={data.organization}
|
|
|
+ >
|
|
|
+ <PerformanceLanding
|
|
|
+ router={data.router}
|
|
|
+ organization={data.organization}
|
|
|
+ location={data.router.location}
|
|
|
+ eventView={eventView}
|
|
|
+ projects={data.projects}
|
|
|
+ selection={eventView.getPageFilters()}
|
|
|
+ onboardingProject={undefined}
|
|
|
+ handleSearch={() => {}}
|
|
|
+ handleTrendsClick={() => {}}
|
|
|
+ setError={() => {}}
|
|
|
+ withStaticFilters={withStaticFilters}
|
|
|
+ />
|
|
|
+ </MetricsCardinalityProvider>
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -133,7 +132,7 @@ describe('Performance > Landing > MetricsDataSwitcher', function () {
|
|
|
features,
|
|
|
});
|
|
|
|
|
|
- wrapper = render(<WrappedComponent data={data} />);
|
|
|
+ wrapper = render(<WrappedComponent data={data} />, {organization: data.organization});
|
|
|
expect(screen.getByTestId('performance-landing-v3')).toBeInTheDocument();
|
|
|
});
|
|
|
|
|
@@ -146,7 +145,7 @@ describe('Performance > Landing > MetricsDataSwitcher', function () {
|
|
|
features,
|
|
|
});
|
|
|
|
|
|
- wrapper = render(<WrappedComponent data={data} />);
|
|
|
+ wrapper = render(<WrappedComponent data={data} />, {organization: data.organization});
|
|
|
|
|
|
expect(await screen.findByTestId('transaction-search-bar')).toBeInTheDocument();
|
|
|
});
|
|
@@ -164,7 +163,7 @@ describe('Performance > Landing > MetricsDataSwitcher', function () {
|
|
|
features,
|
|
|
});
|
|
|
|
|
|
- wrapper = render(<WrappedComponent data={data} />);
|
|
|
+ wrapper = render(<WrappedComponent data={data} />, {organization: data.organization});
|
|
|
|
|
|
expect(await screen.findByTestId('transaction-search-bar')).toBeInTheDocument();
|
|
|
});
|
|
@@ -182,7 +181,7 @@ describe('Performance > Landing > MetricsDataSwitcher', function () {
|
|
|
features,
|
|
|
});
|
|
|
|
|
|
- wrapper = render(<WrappedComponent data={data} />);
|
|
|
+ wrapper = render(<WrappedComponent data={data} />, {organization: data.organization});
|
|
|
expect(await screen.findByTestId('transaction-search-bar')).toBeInTheDocument();
|
|
|
expect(
|
|
|
await screen.findByTestId('landing-mep-alert-single-project-incompatible')
|
|
@@ -204,7 +203,7 @@ describe('Performance > Landing > MetricsDataSwitcher', function () {
|
|
|
features,
|
|
|
});
|
|
|
|
|
|
- wrapper = render(<WrappedComponent data={data} />);
|
|
|
+ wrapper = render(<WrappedComponent data={data} />, {organization: data.organization});
|
|
|
expect(await screen.findByTestId('transaction-search-bar')).toBeInTheDocument();
|
|
|
expect(
|
|
|
await screen.findByTestId('landing-mep-alert-multi-project-incompatible')
|
|
@@ -226,7 +225,7 @@ describe('Performance > Landing > MetricsDataSwitcher', function () {
|
|
|
features,
|
|
|
});
|
|
|
|
|
|
- wrapper = render(<WrappedComponent data={data} />);
|
|
|
+ wrapper = render(<WrappedComponent data={data} />, {organization: data.organization});
|
|
|
expect(await screen.findByTestId('transaction-search-bar')).toBeInTheDocument();
|
|
|
expect(
|
|
|
await screen.findByTestId('landing-mep-alert-multi-project-all-incompatible')
|
|
@@ -246,7 +245,7 @@ describe('Performance > Landing > MetricsDataSwitcher', function () {
|
|
|
features,
|
|
|
});
|
|
|
|
|
|
- wrapper = render(<WrappedComponent data={data} />);
|
|
|
+ wrapper = render(<WrappedComponent data={data} />, {organization: data.organization});
|
|
|
expect(await screen.findByTestId('transaction-search-bar')).toBeInTheDocument();
|
|
|
expect(
|
|
|
await screen.findByTestId('landing-mep-alert-unnamed-discover')
|
|
@@ -266,7 +265,7 @@ describe('Performance > Landing > MetricsDataSwitcher', function () {
|
|
|
features,
|
|
|
});
|
|
|
|
|
|
- wrapper = render(<WrappedComponent data={data} />);
|
|
|
+ wrapper = render(<WrappedComponent data={data} />, {organization: data.organization});
|
|
|
expect(await screen.findByTestId('transaction-search-bar')).toBeInTheDocument();
|
|
|
expect(
|
|
|
await screen.findByTestId('landing-mep-alert-unnamed-discover-or-set')
|
|
@@ -286,7 +285,7 @@ describe('Performance > Landing > MetricsDataSwitcher', function () {
|
|
|
features,
|
|
|
});
|
|
|
|
|
|
- wrapper = render(<WrappedComponent data={data} />);
|
|
|
+ wrapper = render(<WrappedComponent data={data} />, {organization: data.organization});
|
|
|
expect(await screen.findByTestId('transaction-search-bar')).toBeInTheDocument();
|
|
|
expect(
|
|
|
await screen.findByTestId('landing-mep-alert-unnamed-discover')
|