Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6214

How to Write Unit Test Case for Geo-Location on Use Effect react [closed]

$
0
0

Hi am new to jest test cases on reactcan someone Guide me approach to write Unit Test Case for geolocation on React UseEffet method and Thanks in Advance !

    useEffect(() => {        const getMyLocation = () => {          const location = window.navigator && window.navigator.geolocation;          if (location) {            location.getCurrentPosition((position) => {              setIsAcceptedGeoLocation(true);              setCurrentLatLng({                latitude: position.coords.latitude,                longitude: position.coords.longitude,              });            }, (error) => {              setIsAcceptedGeoLocation(false);              console.error('error', error);            });          }        };        getMyLocation();      }, []);

Viewing all articles
Browse latest Browse all 6214

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>