TypeError:无法在主机组件上调用 ShallowWrapper::dive()

Hen*_*and 3 reactjs enzyme

我正在关注 goreact testess 视频并在这里尝试。我的尝试没有成功。我有以下错误:

TypeError: ShallowWrapper :: dive () can not be called on Host Components

错误: https: //i.stack.imgur.com/WORpE.jpg

该项目位于 git 中,如果您想更好地了解整个示例: https: //github.com/henriqueweiand/reactjs-crud-state-test

小智 5

快速浏览一下您的项目,您需要使用以下内容:

wrapper
  .find('DocumentosTable')
  .dive()
  .find('FaTrash')
  .first()
  .simulate('click');
Run Code Online (Sandbox Code Playgroud)

请注意文档中的注释,它应该解释您看到该错误的原因。

Dive can only be called on a wrapper of a single non-DOM component element node, otherwise it will throw an error.

有关潜水的更多信息,请访问此处