无法使用玩笑读取未定义的属性“ keyfield”

时间:2019-09-12 08:16:04

标签: reactjs

  

我正在写开玩笑的案例。我收到错误信息-无法读取   属性“ keyfield”未定义。

describe("<AccountOverview >", () => {
    let wrap, data;
    beforeEach(() => {
         data = {
            userPref: {
                fontSize: "12px"
             },
             user: {
               "response" : {
                "requestReturn": "N",
                "actionType": null,
                "messages": {"msg":       {
                   "value": "",
                   "code": "00",
                   "message": "OK"
                }},
                "errorMessages": null,
                "errorResponse": null,
                "ntwkAcctDetails":       {
                   "keyFields": {"ntwkData":          {
                      "account":             {
                         "branchNo": "1236666",
                         "accountNo": "687678",
                         "accountType": "9",
                         "checkDigit": "5"
                      },
                      "fundNo": "B1877A103",
                      "dividend": "H"
                   }},
.
.
.
}
 wrap = shallow(<AccountOverview data={data} />
})
  

这是我在组件中的渲染部分   这是我在组件中的渲染部分

 const { keyFields: { ntwkData: { account: { branchNo, accountNo, accountType, checkDigit }, fundSecurityNo } }, accountDetails } = this.props.data.user.response.ntwkAcctDetails;
        const { keyFields: { ntwkData: { dividend: afterSaveDividend } }, accountDetails: saveAccDetails } = this.props.data.user.request;

0 个答案:

没有答案