TypeError:无法读取Jest测试中未定义的属性“值”

时间:2020-07-05 13:15:11

标签: jestjs enzyme

我在尝试渲染类时遇到此错误。呈现此页面作为一部分的App js时,我没有出现任何错误。我已使用Jest JS进行测试。有人可以帮我吗?

// Page1.js

<CustomRadioGroup
                label="What would you like to use the loan for?"
                name="loan"
                value={this.props.formikProps.values.loan}
                type="radio"
                options={[
                  "abc",
                  "def",
                  "ghi"
                ]}
              />

// Page1.test.js

it("render without crashing", () => {
    const {debug} = render(<Page1/>)
    debug();
})

错误:

  26 |                 label="What would you like to use the loan for?"
  27 |                 name="loan"
> 28 |                 value={this.props.formikProps.values.loan}
     |                                               ^

0 个答案:

没有答案