I want to test the state update of the component using renderHook from @testing-library/react-hooks, which let us render the hook in the same way as we do in a react functional component. Just want to know, is this only applicable for custom hooks, because the state is not getting changed when I am trying this for testing a component
it('test count update', () => {
const { result } = renderHook(() => useState({ count: 0 }));
const [state, setState] = result.current;
const wrapper = mount(<ComponentToTest />);
act(() => {
wrapper.find('button').simulate('click');
})
expect(state).toBe({ count: 1 });
})
getting an error since the count is not getting updated and still remains 0
Can anyone please help
