Description
In our version of MapStore, we are currently using a newer version of react-redux, i.e. 7.1.3 instead of 6.0.0, because it has a much cleaner syntax.
However, this breaks tests, because of the render-function from react-dom, which is frequently being used like this:
// StandardAppComponent-test
const app = ReactDOM.render(<Provider store={store}><StandardAppComponent/></Provider>, document.getElementById("container"));
expect(app).toExist();
render does not return anything for stateless components:
Render a React element into the DOM in the supplied container and return a reference to the component (or returns null for stateless components).
And apparently, by upgrading to react-redux 7.x, some components become stateless.
A first step to enable you to upgrade to react-redux 7.x and enable us to keep using it would be to rewrite such tests like this:
const container = document.getElementById("container");
expect(container.innerHTML).toNotExist();
ReactDOM.render(<Provider store={store}><StandardAppComponent/></Provider>, container, () => {
expect(container.innerHTML).toExist();
done();
});
Would you accept a pull request with these changes to the tests?
This does not break compatibility with your current react-redux version and might also help with upgrading the tests once you reach
React 18 (where render is deprecated entirely).
What kind of improvement you want to add? (check one with "x", remove the others)
Other useful information
This concerns the tests for
- StandardContainer
- StandardAppComponent
- StandardRouter
- ZoomButton
- ZoomToMaxExtentButton
- HomeComponent
- PluginsContainer
- PaginationToolbar
- MapViewerCmp
- PluginsUtils
Description
In our version of MapStore, we are currently using a newer version of
react-redux, i.e.7.1.3instead of6.0.0, because it has a much cleaner syntax.However, this breaks tests, because of the
render-function fromreact-dom, which is frequently being used like this:renderdoes not return anything for stateless components:And apparently, by upgrading to
react-redux 7.x, some components become stateless.A first step to enable you to upgrade to
react-redux 7.xand enable us to keep using it would be to rewrite such tests like this:Would you accept a pull request with these changes to the tests?
This does not break compatibility with your current
react-reduxversion and might also help with upgrading the tests once you reachReact 18 (where
renderis deprecated entirely).What kind of improvement you want to add? (check one with "x", remove the others)
Other useful information
This concerns the tests for