模拟功能组件测试玩笑和酶中的内部功能

时间:2019-11-29 05:49:32

标签: reactjs unit-testing jestjs enzyme

我们是否可以像以前在类组件中一样使用jest和Enzyme在功能组件测试中模拟内部功能。例如

const MyComponent = () => {
  handleNameInput = (value) => {
    searchDish(value);
  };

  searchDish = (value) => {
    //Do something
  }
  render() {
    return (<div></div>)
  }
}

我想模拟搜索盘。正如我们在问题中提到的在类组件测试中所做的那样 How to mock React component methods with jest and enzyme

0 个答案:

没有答案