const [test, setTest] = useState(5);
const handleClick = () => {
setTest(6));
};
<Button onClick={handleClick}>
test
</Button>
сам тест:
test('handleClick', () => {
const button = rrr.root.findAllByType(Button)[1];
const mockRenderCustomItem = jest.fn(() => 1);
expect(button.props.onClick()).toEqual(mockRenderCustomItem);
});