Fixing issue in the react and redux template where the test would fail as its not wrapped in a router.
This commit is contained in:
parent
ec6cb2a646
commit
f7a9b6f6a3
|
|
@ -1,8 +1,12 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
|
import { MemoryRouter } from 'react-router-dom';
|
||||||
import App from './App';
|
import App from './App';
|
||||||
|
|
||||||
it('renders without crashing', () => {
|
it('renders without crashing', () => {
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
ReactDOM.render(<App />, div);
|
ReactDOM.render(
|
||||||
|
<MemoryRouter>
|
||||||
|
<App />
|
||||||
|
</MemoryRouter>, div);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -21,5 +21,8 @@
|
||||||
"build": "react-scripts build",
|
"build": "react-scripts build",
|
||||||
"test": "react-scripts test --env=jsdom",
|
"test": "react-scripts test --env=jsdom",
|
||||||
"eject": "react-scripts eject"
|
"eject": "react-scripts eject"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"redux-mock-store": "^1.5.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,18 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
|
import { Provider } from 'react-redux';
|
||||||
|
import { MemoryRouter } from 'react-router-dom';
|
||||||
|
import configureStore from 'redux-mock-store';
|
||||||
import App from './App';
|
import App from './App';
|
||||||
|
|
||||||
it('renders without crashing', () => {
|
it('renders without crashing', () => {
|
||||||
|
const mockStore = configureStore([])({});
|
||||||
|
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
ReactDOM.render(<App />, div);
|
ReactDOM.render(
|
||||||
|
<Provider store={mockStore}>
|
||||||
|
<MemoryRouter>
|
||||||
|
<App />
|
||||||
|
</MemoryRouter>
|
||||||
|
</Provider>, div);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue