用玩笑和酶测试蚂蚁设计表格

时间:2020-01-06 09:55:45

标签: reactjs typescript forms jestjs enzyme

我正在尝试用开玩笑/酶打字稿测试表格,但是我被卡住了。这是示例:

class TestForm extends React.Component<FormComponentProps> {
    render() {
        console.log("TESTFORMPROPS: ", this.props)
        const { getFieldDecorator } = this.props.form;
        return (
            <Form>
                <Form.Item label="name">
                    {getFieldDecorator('name', {
                        rules: [
                            {
                                type: 'string',
                                required: true,
                            },
                        ],
                        initialValue: 'mary',
                    })(<input />)}
                </Form.Item>
            </Form>
        );
    }
}
const WrappedForm = Form.create()(TestForm);

现在,当我查看日志(“ TESTFORMPROPS:”)时,如果执行以下测试,我会清楚地看到一个表单:

describe(`Testing the Login component`, () => {
    const wrapper = mount(<WrappedForm/>);
    console.log("TESTINGPROPS: ", wrapper.props())
    });

我得到了日志(“ TESTINGPROPS:”):

{}

有人知道如何使用打字稿测试蚂蚁设计形式与酶和开玩笑的反应吗?

0 个答案:

没有答案