首页 > 解决方案 > 方法“模拟”意味着在 1 个节点上运行。发现 0 相反错误出现在终端上

问题描述

我最近对 ​​POdashboard.js 组件进行了一些更改并运行了测试套件。后来我在终端中的 POdashboard.test.js 上收到以下错误。

PoDashboard 组件 › 应该使用有效的道具呈现 DataTable 组件

方法“模拟”意味着在 1 个节点上运行。找到了 0 个。

  expect(poDashboardComponent.find('DataTable').props().onChangeRowsPerPage()).toBeUndefined();
expect(poDashboardComponent.find('DataTable').props().onOrderChange(0, 'asc', state.poData.poDataList.data));
expect(poDashboardComponent.find('.MuiTableSortLabel-icon').at(0).simulate('click'));
      
      test('should render Alert components', () => {

      at ReactWrapper.single (node_modules/enzyme/src/ReactWrapper.js:1168:13)
      at ReactWrapper.simulate (node_modules/enzyme/src/ReactWrapper.js:665:17)
      at Object.<anonymous> (tests/components/pages/PoDashboard/PoDashboard.test.js:118:75)

标签: reactjsmaterial-uireact-table

解决方案


推荐阅读