Skip to content

Commit 0f4429f

Browse files
authored
ref(tsc): re-write discover saved queries page to useApiQuery (#87162)
This is a refactoring as part of the `DeprecatedAsyncComponent` removal initiative.
1 parent 2579540 commit 0f4429f

File tree

4 files changed

+227
-304
lines changed

4 files changed

+227
-304
lines changed

static/app/views/discover/index.spec.tsx static/app/views/discover/landing.spec.tsx

+14-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import {OrganizationFixture} from 'sentry-fixture/organization';
22
import {ProjectFixture} from 'sentry-fixture/project';
3-
import {RouteComponentPropsFixture} from 'sentry-fixture/routeComponentPropsFixture';
43

54
import {render, screen} from 'sentry-test/reactTestingLibrary';
65
import selectEvent from 'sentry-test/selectEvent';
76

87
import ProjectsStore from 'sentry/stores/projectsStore';
9-
import {DiscoverLanding} from 'sentry/views/discover/landing';
8+
import DiscoverLanding from 'sentry/views/discover/landing';
9+
10+
import {OrganizationContext} from '../organizationContext';
1011

1112
describe('Discover > Landing', function () {
1213
const eventTitle = 'Oh no something bad';
@@ -73,20 +74,19 @@ describe('Discover > Landing', function () {
7374
});
7475

7576
it('denies access on missing feature', function () {
76-
render(
77-
<DiscoverLanding
78-
organization={OrganizationFixture()}
79-
{...RouteComponentPropsFixture()}
80-
/>
81-
);
77+
render(<DiscoverLanding />);
8278

8379
expect(screen.getByText("You don't have access to this feature")).toBeInTheDocument();
8480
});
8581

8682
it('has the right sorts', async function () {
8783
const org = OrganizationFixture({features});
8884

89-
render(<DiscoverLanding organization={org} {...RouteComponentPropsFixture()} />);
85+
render(
86+
<OrganizationContext.Provider value={org}>
87+
<DiscoverLanding />
88+
</OrganizationContext.Provider>
89+
);
9090

9191
const expectedSorts = [
9292
'My Queries',
@@ -111,7 +111,11 @@ describe('Discover > Landing', function () {
111111
it('links back to the homepage', async () => {
112112
const org = OrganizationFixture({features});
113113

114-
render(<DiscoverLanding organization={org} {...RouteComponentPropsFixture()} />);
114+
render(
115+
<OrganizationContext.Provider value={org}>
116+
<DiscoverLanding />
117+
</OrganizationContext.Provider>
118+
);
115119

116120
expect(await screen.findByText('Discover')).toHaveAttribute(
117121
'href',

0 commit comments

Comments
 (0)