Check out example codes for "react typescript testing". It will help you in understanding the concepts better.

Code Example 1

npm install @types/jest @testing-library/react @testing-library/jest-dom jest ts-jest

# Yarn
yarn add @types/jest @testing-library/react @testing-library/jest-dom jest ts-jest

Learn ReactJs, React Native from akashmittal.com