TypeError:无法读取Jest-Enzyme-Redux测试中未定义的属性“ statusList”

时间:2019-10-22 04:46:04

标签: unit-testing react-redux jestjs

我是jest / redux的新手-测试并尝试测试连接的组件,其中包括存储在redux中的数据。我在以适当的方式检索数据时遇到问题。

以下是.js文件中的

 <ReactTabulator
              id="status_Tabulator"
              ref={ref => (this.ref = ref)}
              data={this.props.state.statusList}
              .
              .
              . />

这是.test.js

it('Rendering Table', () => {
      expect(wrapper.find('div').containsMatchingElement([<ReactTabulator id="status_Tabulator"/>])).toBe(true);
    });

错误就这样

  TypeError: Cannot read property 'statusList' of undefined

      303 |                 {title: "Last Refreshed", field: "lastRefreshed"},
      304 |               ]}
    > 305 |               data={this.props.state.statusList}
          |                                      ^

0 个答案:

没有答案