使用'@testing-library/react'
,
提供了以下组件:
const Home = () => {
const submit = () => console.log('submit clicked');
return (
<div>
Home
<Button
onClick={submit}
>
Submit
</Button>
</div>
)
}
要完成下面的测试,必须添加什么断言?
it('reacts to a submit event', async () => {
const { getByText } = render(<Home />);
fireEvent.click(getByText(/submit/i));
})