@@ -154,7 +154,7 @@ afterAll(() => {
154154
155155``` jsx
156156// hidden-message.js
157- import React from ' react'
157+ import * as React from ' react'
158158
159159// NOTE: React Testing Library works well with React Hooks and classes.
160160// Your tests will be the same regardless of how you write your components.
@@ -184,7 +184,7 @@ export default HiddenMessage
184184import ' @testing-library/jest-dom'
185185// NOTE: jest-dom adds handy assertions to Jest and is recommended, but not required
186186
187- import React from ' react'
187+ import * as React from ' react'
188188import {render , fireEvent , screen } from ' @testing-library/react'
189189import HiddenMessage from ' ../hidden-message'
190190
@@ -209,7 +209,7 @@ test('shows the children when the checkbox is checked', () => {
209209
210210``` jsx
211211// login.js
212- import React from ' react'
212+ import * as React from ' react'
213213
214214function Login () {
215215 const [state , setState ] = React .useReducer ((s , a ) => ({... s, ... a}), {
@@ -233,9 +233,7 @@ function Login() {
233233 password: passwordInput .value ,
234234 }),
235235 })
236- .then ((r ) =>
237- r .json ().then ((data ) => (r .ok ? data : Promise .reject (data)))
238- )
236+ .then (r => r .json ().then (data => (r .ok ? data : Promise .reject (data))))
239237 .then (
240238 user => {
241239 setState ({loading: false , resolved: true , error: null })
@@ -276,15 +274,15 @@ export default Login
276274// again, these first two imports are something you' d normally handle in
277275// your testing framework configuration rather than importing them in every file.
278276import ' @testing-library/jest-dom'
279- import React from ' react'
277+ import * as React from ' react'
280278// import API mocking utilities from Mock Service Worker.
281279import {rest } from ' msw'
282280import {setupServer } from ' msw/node'
283281// import testing utilities
284282import {render , fireEvent , screen } from ' @testing-library/react'
285283import Login from ' ../login'
286284
287- const fakeUserResponse = { token: ' fake_user_token' }
285+ const fakeUserResponse = {token: ' fake_user_token' }
288286const server = setupServer (
289287 rest .post (' /api/login' , (req , res , ctx ) => {
290288 return res (ctx .json (fakeUserResponse))
@@ -400,8 +398,8 @@ principles:
400398 ` react- dom` .
4013993. Utility implementations and APIs should be simple and flexible.
402400
403- Most importantly, we want React Testing Library to be pretty
404- light-weight, simple, and easy to understand.
401+ Most importantly, we want React Testing Library to be pretty light-weight,
402+ simple, and easy to understand.
405403
406404## Docs
407405
@@ -410,8 +408,7 @@ light-weight, simple, and easy to understand.
410408
411409## Issues
412410
413- Looking to contribute? Look for the [Good First Issue][good-first-issue]
414- label.
411+ Looking to contribute? Look for the [Good First Issue][good-first-issue] label.
415412
416413### 🐛 Bugs
417414
@@ -607,6 +604,7 @@ Thanks goes to these people ([emoji key][emojis]):
607604
608605<!-- markdownlint-enable -->
609606<!-- prettier-ignore-end -->
607+
610608<!-- ALL-CONTRIBUTORS-LIST:END -->
611609
612610This project follows the [all-contributors][all-contributors] specification.
0 commit comments