Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFR] Reference hooks #3228

Merged
merged 8 commits into from
May 16, 2019
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 25 additions & 56 deletions packages/ra-core/src/controller/ListController.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ListController, {
sanitizeListRestProps,
} from './ListController';

import TestContext from '../util/TestContext';
import renderWithRedux from '../util/renderWithRedux';
import { CRUD_CHANGE_LIST_PARAMS } from '../actions';

describe('ListController', () => {
Expand Down Expand Up @@ -60,24 +60,13 @@ describe('ListController', () => {
children: fakeComponent,
};

let reduxStore;
let dispatch;

const { getByLabelText } = render(
<TestContext
store={{
admin: {
resources: { posts: { list: { params: {} } } },
},
}}
enableReducers
>
{({ store }) => {
reduxStore = store;
dispatch = jest.spyOn(store, 'dispatch');
return <ListController {...props} />;
}}
</TestContext>
const { getByLabelText, dispatch, reduxStore } = renderWithRedux(
<ListController {...props} />,
{
admin: {
resources: { posts: { list: { params: {} } } },
},
}
);
const searchInput = getByLabelText('search');

Expand Down Expand Up @@ -110,22 +99,13 @@ describe('ListController', () => {
children: fakeComponent,
};

let dispatch;

const { getByLabelText } = render(
<TestContext
store={{
admin: {
resources: { posts: { list: { params: {} } } },
},
}}
enableReducers
>
{({ store }) => {
dispatch = jest.spyOn(store, 'dispatch');
return <ListController {...props} />;
}}
</TestContext>
const { getByLabelText, dispatch } = renderWithRedux(
<ListController {...props} />,
{
admin: {
resources: { posts: { list: { params: {} } } },
},
}
);
const searchInput = getByLabelText('search');

Expand All @@ -148,30 +128,19 @@ describe('ListController', () => {
children: fakeComponent,
};

let reduxStore;
let dispatch;

const { getByLabelText } = render(
<TestContext
store={{
admin: {
resources: {
posts: {
list: {
params: { filter: { q: 'hello' } },
},
const { getByLabelText, dispatch, reduxStore } = renderWithRedux(
<ListController {...props} />,
{
admin: {
resources: {
posts: {
list: {
params: { filter: { q: 'hello' } },
},
},
},
}}
enableReducers
>
{({ store }) => {
reduxStore = store;
dispatch = jest.spyOn(store, 'dispatch');
return <ListController {...props} />;
}}
</TestContext>
},
}
);
const searchInput = getByLabelText('search');

Expand Down
Loading