I have a project structure like this:
app/
global/
styles/
components/
scenes/
Home/
actions.js
constants.js
index.jsx
reducer.js
sagas.js
styles.styl
index.spec.jsx
some-other-scene/
actions.js
constants.js
index.jsx
reducer.js
sagas.js
styles.styl
index.spec.jsx
so I have no problem with unit test with this structure, but I'm pretty confused as to how to structure integration test. For my unit tests I am exporting each scene component as a class
export class SomeComponent extends Component {}
and as a redux connected component
export default connect(
mapStateToProps,
mapDispatchToProps
)(SomeComponent)
So for the fist style of export (the class) I am unit testing it, but for the second way (the connected component way) I am unsure how to approach this specifically how to do integration testing in react/redux. I've searched the internet about this, but nothing that is close to this structure.
So:
- is integration testing in react/redux/middleware (in this case redux saga) how one component integrates with redux and middleware.
- Or is it about how the whole app works with all the components mounted?
- if it's #1 does that mean each component should have a single integration test file that tests how the component integrates with redux and middleware or if it's #2 then is it one test file that tests all components as one app?
also, if it's #1 then how should I test routes via react router?