Reputation: 561
My react class components looks like this:
import { Field, reduxForm, propTypes } from 'redux-form';
class DepositAmountInput extends Component {
render() {
return (
<View>
<Field
component={NumberInputField}
props={{
onChange: this.handleInput,
onBlur: this.handleOnBlur
}}
/>
</View>
);
}
}
export default DepositAmountInput
In my Jest test for this component, how can I mock the Field component of redux-form? I am looking for something like this:
.mock('redux-form/lib/Field', () => 'Field');
Thanks!
Upvotes: 2
Views: 1665
Reputation: 139
this is the code which runs perfectly well on my test ( see picture below )
jest.mock('redux-form/lib/Field', () => 'field');
(same as the one you were expecting then. )
on my pacakage.json :
{
"redux-form": "^7.0.3",
"jest": "^20.0.4",
}
Upvotes: 1