Skip to content

Commit

Permalink
test(ListView): provide store
Browse files Browse the repository at this point in the history
  • Loading branch information
msyavuz committed Jan 9, 2025
1 parent 5b22577 commit f5a699d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions superset-frontend/src/components/ListView/ListView.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import { styledMount as mount } from 'spec/helpers/theming';
import { act } from 'react-dom/test-utils';
import { QueryParamProvider } from 'use-query-params';
import { supersetTheme, ThemeProvider } from '@superset-ui/core';
import thunk from 'redux-thunk';
import configureStore from 'redux-mock-store';

import Button from 'src/components/Button';
import { Empty } from 'src/components/EmptyState/Empty';
Expand All @@ -33,6 +35,10 @@ import TableCollection from 'src/components/TableCollection';
import Pagination from 'src/components/Pagination/Wrapper';

import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint';
import { Provider } from 'react-redux';

const middlewares = [thunk];
const mockStore = configureStore(middlewares);

function makeMockLocation(query) {
const queryStr = encodeURIComponent(query);
Expand Down Expand Up @@ -125,12 +131,15 @@ const mockedProps = {

const factory = (props = mockedProps) =>
mount(
<QueryParamProvider location={makeMockLocation()}>
<ListView {...props} />
</QueryParamProvider>,
<Provider store={mockStore()}>
<QueryParamProvider location={makeMockLocation()}>
<ListView {...props} />
</QueryParamProvider>
</Provider>,
{
wrappingComponent: ThemeProvider,
wrappingComponentProps: { theme: supersetTheme },
useRedux: true,
},
);

Expand Down

0 comments on commit f5a699d

Please sign in to comment.