We are creating React-Native mobile App Using Salesforce Mobile SDK. In this project we setup JEST for unit test cases writing. But whenever it goes into Salesforce Mobile SDK API it failed and sends timeout error. So due to this we are not able to get response and unit test cases are not working. It would be great if anyone suggest something for how to write unit test cases for a component/react-native project that uses Salesforce mobilesdk.
Unit tests should not depend on external api calls, instead they should be mocked to provide a success and error response.
to mock or spy on a function please find documentation from jest
I would prefer to use spy with a mockResolvedValue and mockRejectedValue but you can decide on basis of your usecase.