DEV Community

pacozaa
pacozaa

Posted on

Diary - React Native TESTING !@#?

Well, this will be random.

I am currently trying to add Jest to my one-year-old mobile apps. It has been developed and improves constantly and now to a point where I want to have solid testing in my skill set.

I was trying an automated test with Detox then I hit the problem that it is so difficult to solve the problems.

  • I can't tap on system permission popup on IOS.
  • I can't make it work with android.

Then I step back a little bit.

I have tried to use Jest with react native before but the project stated and timing seem to be too short and have to skip unit "testing".

But now I am ready to tackle the problem again.

I started with small and little cute components and it works!

SNAPSHOT - Huray!

then I step up a bit and work with "Home" component. It doesn't work YET.

what I have done so far is configuring jest and mock function left and right then I hit the big function which I am right now too lazy to mock. I am looking for cleaner solution rather than mock my way out to freedom.

Top comments (2)

Collapse
 
pavermakov profile image
Pavel Ermakov

What's the point of the snapshots? You create one, then change the component, which triggers an error next time you compare your snapshots. What are you testing?

Collapse
 
pacozaa profile image
pacozaa

To be honest, the point of doing it right now is for the sake of running the test without error. And that's it. I don't think my on going work will do the proper test very soon.