У меня проблема при тестировании редукса с использованием функции ферментов mount
.
Error: Uncaught [TypeError: selectors.selectMessages is not a function]
Почему я получаю эту ошибку?
//badgeSelector.js. R - is Ramda.
import { createSelector } from 'reselect'
export const selectMessages = createSelector(R.path(['badgeReducer', 'unreadMessages']), (messages) => messages)
//App.js
import * as selectors from 'commons/selectors/badgeSelector'
export class App extends PureComponent {
render() {
return (
...
)
}
}
export default connect(
(state) => ({
messages: selectors.selectMessages(state)
}),
(dispatch) => ({
updateBadge: () => {
dispatch(updateBadge())
}
})
)(App)
//App.test.js
import ConnectedApp, {App} from './App'
describe('Badge react-redux test mount: ', () => {
const mockStore = configureStore()
let store, wrapper
beforeEach(() => {
store = mockStore(state)
wrapper = mount(<Provider store={store}><ConnectedApp /></Provider>) //Error when mount
})
it('render mount component', () => {
expect(wrapper.find(ConnectedApp).length).toEqual(1)
})
})