Unit testable components pt.4: Testing the Redux data flow
Testing actions within actions Testing redux is verbose. Sometimes it is even difficult. But it doesn't matter where you do it. It will always be challenging. The difference is that the DOM is irrelevant for my approach to testing. I use redux-mock-store to test my actions. No need for enzyme. One less moving part to deal with. That is the whole point of this testing style. Here is what a sample test would look like The action process const processHomeMount = () => async (dispatch, getState) => { try { const type = getState().home.topSearches.focusedDateRange const { endDate, startDate } = createPresentDateRange({ daysAgo: 100 }) await Promise.all([ dispatch(fetchPopularSearches({ type, limit: TOP_SEARCH_ENTRY_COUNT })),...