react-hooks-testing-library icon indicating copy to clipboard operation
react-hooks-testing-library copied to clipboard

React Unit Test Case for Navigation

Open carmelrajtradu opened this issue 1 year ago • 0 comments

I need some ones help to write a unit test for this code. I have write a test case but its not working. I can't copy and past original so I have created dummy code and pasted it.

import {useState, useEffect} from 'React'; import {useNavigate} from 'react-router-dom'; import {useSelector} from 'react-redux'; const componentName=()=>{ const navigate = useNavigate(); const {loginRes} = useSelector((state).signUp) const [data, setData] = useState()

useEffect(()=>{
	if(loginRes.autoRejection){
		navigate('/rejection')
	}else{
		navigate('/docUpload')
	}
},[loginRes])

} export default componentName;

carmelrajtradu avatar Jun 28 '24 07:06 carmelrajtradu