AND THINGS I LEARNED ALONG THE WAY
All v6 problems + open issue on GitHub.
...there's a workaround to solve issue with react-redux v7
but first we need to solve all issues with react-redux v6
jest.mock('../../node_modules/react-redux/lib/utils/batch.js', () => ({
setBatch: jest.fn(),
getBatch: () => fn => fn()
}));
>>>...why I never use shallow rendering... With shallow rendering, I can refactor my component's implementation and my tests break. With shallow rendering, I can break my application and my tests say everything's still working. - @kentcdodds
Transitioning from shallow rendering:
https://youtu.be/LHUdxkThTM0?list=PLV5CVI1eNcJgCrPH_e6d57KRUTiDZgs0u
Testing React Components with react-test-renderer and the Act API:
https://www.valentinog.com/blog/testing-react/
Unit testing React components:
https://medium.com/javascript-scene/unit-testing-react-components-aeda9a44aae2
Write tests. Not too many. Mostly integration.
https://kentcdodds.com/blog/write-tests
We need to replicate our store and stop trusting Enzyme to render our components in an "isolate" mode.
This library directly prevents us from doing isolated tests. Remember that every test can be unit or integration.