google-maps-react icon indicating copy to clipboard operation
google-maps-react copied to clipboard

How can I test the map container with Jest and Enzyme?

Open avgDev0 opened this issue 6 years ago • 2 comments

I have a view where I'm rendering the map wrapped in the GoogleApiWrapper HOC that the package includes, I'm getting props like the center of the map from some functions within the class that contains the map. Also some other props that would affect the map (markers quantity, center, etc) migth vary based on some logic that calculates them before passing them to the Map component.

I'm testing on Jest with Enzyme and all I'm getting after the shallow command is the <DefaultLoadingContainer /> component, if I .dive() that, I'll get the

containing the Loading... text and that's it.

Is there some way to bypass that LoadingContainer (or some like that) and get the actual <Map /> component?

Maybe I'm doing some bad tests and I shouldn't be validation this information in this test?

Any help is appreciated.

avgDev0 avatar Jun 08 '19 00:06 avgDev0

@LuisMercadoS
I recently ran into the same issue, I'm still trying to figure this out.. Did you ever have any luck?

mikemeyer30 avatar Apr 13 '20 01:04 mikemeyer30

Hi @avgDev0 , am also struck with this issue. Could you please share us if you were able to find a solution by this time?

ShreeGiriKumar avatar Nov 28 '20 17:11 ShreeGiriKumar