In component I have a button which redirects to another page
const handleAddButton = () => {
navigate('url');
};
I try to testing the case when function calls after clicking on a button. But test returns 0.
it('lick on a button', async () => {
const onClick = jest.fn()
render(
<Wrapper >
<Component onClick={onClick} />
</Wrapper>
);
fireEvent.click(screen.getByText('Add Button'))
});
})
I use jest
+ react
testing library. Could you please explain to me why it happens?