From a65c5c37a0088f5f6836063161428914c3ef050b Mon Sep 17 00:00:00 2001 From: Gpx Date: Wed, 19 Sep 2018 17:24:37 +0200 Subject: [PATCH] =?UTF-8?q?docs:=20=E2=9C=8F=EF=B8=8F=20fix=20"handle=20su?= =?UTF-8?q?bmit"=20test=20and=20add=20expectation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "clicks submit button" test was not working because it was missing `handleClick`. Also, it did not have any expectation which is weird for a test. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 375b2031..b08e54de 100644 --- a/README.md +++ b/README.md @@ -607,9 +607,11 @@ import {render, cleanup, fireEvent} from 'react-testing-library' afterEach(cleanup) test('clicks submit button', () => { + const handleClick = jest.fn() const {getByText} = render() fireEvent.click(getByText('Submit')) + expect(handleClick).toHaveBeenCalledTimes(1) }) ```