0

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.

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.