【发布时间】:2017-08-29 10:15:43
【问题描述】:
我的 react 类组件如下所示:
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
在我对此组件的 Jest 测试中,如何模拟 redux-form 的 Field 组件?我正在寻找这样的东西:
.mock('redux-form/lib/Field', () => 'Field');
谢谢!
【问题讨论】:
标签: testing react-native react-redux jestjs