Open Queist opened 2 years ago
When you use a 3rd-party library, these kinds of concerns can arise.
As you mentioned, you don't have to test and even cannot test logic inside of Google library.
However, this doesn't mean that testing your own code of using the library is trivial.
Even though it seems not meaningful because GoogleMap(which you represented as essential codes) are skipped by mocking, writing tests for the rest of your code may help find a bug, for example, when you modify the logic of onLoad
in the wrong way in the future.
If you want to discuss how to write a test, it would be better to discuss with actual codes. In that case, please let us see your implementation and talk to you.
That's been a sufficient answer. Thank you.
I have no idea with testing google map component.
Google map component is related to network so jest cannot render it.
Of course, I can mocking components like GoogleMap or Marker or something.
However, essential codes are inside of those component. (Almost half of my code is function in onLoad props of GoogleMap component.)
So even i mock GoogleMap component, it can't really be meaningful testing because it just skips all essential codes!
Is it right to give up testing those part?
Or is there another "correct" way to test?