我是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}
| ^