refactor: Upgrade Redux (#11967)

* upgrade redux and react-redux, adjust types

* first round of test fixes

* fix rest of unit tests

* lint

Co-authored-by: Phillip Kelley-Dotson <pkelleydotson@yahoo.com>
This commit is contained in:
David Aaron Suddjian
2020-12-09 11:58:42 -08:00
committed by GitHub
parent 9121482479
commit 6270fa2026
41 changed files with 354 additions and 253 deletions

View File

@@ -20,6 +20,7 @@ import React from 'react';
import thunk from 'redux-thunk';
import configureStore from 'redux-mock-store';
import fetchMock from 'fetch-mock';
import { Provider } from 'react-redux';
import { styledMount as mount } from 'spec/helpers/theming';
import DatabaseList from 'src/views/CRUD/data/database/DatabaseList';
@@ -81,10 +82,11 @@ fetchMock.get(databaseRelatedEndpoint, {
});
describe('DatabaseList', () => {
const wrapper = mount(<DatabaseList user={mockUser} />, {
context: { store },
});
const wrapper = mount(
<Provider store={store}>
<DatabaseList user={mockUser} />
</Provider>,
);
beforeAll(async () => {
await waitForComponentToPaint(wrapper);
});

View File

@@ -43,12 +43,8 @@ const dbProps = {
};
describe('DatabaseModal', () => {
const wrapper = mount(<DatabaseModal {...mockedProps} />, {
context: { store },
});
const editWrapper = mount(<DatabaseModal {...dbProps} />, {
context: { store },
});
const wrapper = mount(<DatabaseModal store={store} {...mockedProps} />);
const editWrapper = mount(<DatabaseModal store={store} {...dbProps} />);
it('renders', () => {
expect(wrapper.find(DatabaseModal)).toExist();

View File

@@ -20,6 +20,7 @@ import React from 'react';
import thunk from 'redux-thunk';
import configureStore from 'redux-mock-store';
import fetchMock from 'fetch-mock';
import { Provider } from 'react-redux';
import { styledMount as mount } from 'spec/helpers/theming';
import DatasetList from 'src/views/CRUD/data/dataset/DatasetList';
@@ -74,9 +75,11 @@ fetchMock.get(databaseEndpoint, {
});
async function mountAndWait(props) {
const mounted = mount(<DatasetList {...props} user={mockUser} />, {
context: { store },
});
const mounted = mount(
<Provider store={store}>
<DatasetList {...props} user={mockUser} />
</Provider>,
);
await waitForComponentToPaint(mounted);
return mounted;

View File

@@ -19,6 +19,7 @@
import React from 'react';
import thunk from 'redux-thunk';
import configureStore from 'redux-mock-store';
import { Provider } from 'react-redux';
import fetchMock from 'fetch-mock';
import { styledMount as mount } from 'spec/helpers/theming';
import SavedQueryList from 'src/views/CRUD/data/savedquery/SavedQueryList';
@@ -91,9 +92,11 @@ fetchMock.get(queriesDistinctEndpoint, {
});
describe('SavedQueryList', () => {
const wrapper = mount(<SavedQueryList />, {
context: { store },
});
const wrapper = mount(
<Provider store={store}>
<SavedQueryList />
</Provider>,
);
beforeAll(async () => {
await waitForComponentToPaint(wrapper);

View File

@@ -73,9 +73,7 @@ const SAVED_QUERY_PAYLOAD = { result: mockqueries[1] };
fetchMock.get(FETCH_SAVED_QUERY_ENDPOINT, SAVED_QUERY_PAYLOAD);
async function mountAndWait(props = mockedProps) {
const mounted = mount(<SavedQueryPreviewModal {...props} />, {
context: { store },
});
const mounted = mount(<SavedQueryPreviewModal store={store} {...props} />);
await waitForComponentToPaint(mounted);
return mounted;