ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 通用测试框架 Jest [https://jestjs.io/docs/en/getting-started.html](https://jestjs.io/docs/en/getting-started.html) create-react-app 脚手架已经自带 Jest 和 react-testing-library # React Testing Library 目前版本的脚手架已自动安装。 ``` "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^7.1.2", ``` jest-dom 是 react testting library 的扩展插件:[https://github.com/testing-library/jest-dom](https://github.com/testing-library/jest-dom),这个脚手架也也会自动安装。其作用就是写测试代码时多了一些简便的方法。 # 模拟函数的调用 [https://jestjs.io/docs/en/mock-functions](https://jestjs.io/docs/en/mock-functions)