I am trying to access the props in the button tag so that i can check if it exists. But its giving me a property exists of undefined
function Nav (props) {
return (
<nav className='header__nav'>
<Link to={'/login'}>
<button className='header__login'>LOGIN</button>
</Link>
<Link to={'/register'}>
<button className='header__register'>SIGN UP</button>
</Link>
<Link to={'/about-me'}>
<button className='header__aboutme'>ABOUT ME</button>
</Link>
<button className='close__nav' onClick={props.popUpHandler}></button> //want to check if the onClick exists and what happens when i click onto it.
</nav>
)
};
test('on click navigation will be null', () => {
wrapper = mount(<MemoryRouter><Nav/></MemoryRouter>)
expect(wrapper.find('button').at(3).exists()).toBeTruthy(); // PASS
expect(wrapper.find('button').at(3).prop('onClick').exists()).toBeTruthy(); //FAIL
})