I'm trying to implement snapshots with jest and i ran into a problem. The solution is probably simple, but i can't find it.
LoginForm.js
class LoginForm extends React.Component {
constructor(props) {
super(props)
}
}
componentWillMount(){
this.props.startSpinner()
}
render(){
return(....)
}
}
LoginForm.spec.js
it('should render snapshot', () => {
const component = renderer.create(
<LoginForm />
)
const tree = component.toJSON()
expect(tree).toMatchSnapshot()
})
startSpinner action
export function startSpinner() {
return (dispatch) => {
dispatch({
type: 'WINDOW_START_SPINNER',
})
}
}
When i run tests, it throws this error, not only with this action, but with all functions called as a redux action.
TypeError: this.props.startSpinner is not a function
How can i make jest play nice with this redux actions?