Writing a React Component Test with Jest and Testing Library
Goals render a React component in a test mock HTTP/REST calls to the backend verify results achieve the above using typescript, jest and testing-library Application under Test This is our application’s shortened package.json, generated by create-react-app, adding dependencies for … jest testing-library typescript react dom implementations (jest-dom/react-dom) axios (for the HTTP/REST call) package.json { [..] "dependencies": { "@testing-library/jest-dom": "^5.11.4", "@testing-library/react": "^11.1.0", "@testing-library/user-event": "^12.1.10", "@types/jest": "^26.0.15", "@types/node": "^12.0.0", "@types/react": "^17.0.0", "@types/react-dom": "^17.0.0", "react": "^17.0.2", "react-dom": "^17.0.2", "react-scripts": "4.0.3", "typescript": "^4.1.2", "web-vitals": "^1.0.1", "axios": "^0.19.0" }, [..] "eslintConfig": { "extends": [ "react-app", "react-app/jest" ] }, [..] } ...