Advanced testing in React Native with Jest: Components

This post is part of my series on unit testing with Jest in React Native. You can find the introduction here.

In the previous parts, I went through why unit testing is vital and how to test your components using snapshots. While snapshot testing is effective, it fails to test some aspects of the component. Now I would like to talk about more advanced component testing in react native.

read more “Advanced testing in React Native with Jest: Components”

Advanced testing in React Native with Jest: Mocking

This post is part of my series on unit testing with Jest in React Native. You can find the introduction here.

While unit testing your code with Jest, you may come across a time when you have to emulate a certain function. For example, the fetch function that performs HTTP requests, or some hardware-related routines. In such cases, you have to use mocking. Thankfully, jest supports various mocking styles out of the box.

read more “Advanced testing in React Native with Jest: Mocking”