@@ -154,7 +154,7 @@ afterAll(() => {
154
154
155
155
``` jsx
156
156
// hidden-message.js
157
- import React from ' react'
157
+ import * as React from ' react'
158
158
159
159
// NOTE: React Testing Library works well with React Hooks and classes.
160
160
// Your tests will be the same regardless of how you write your components.
@@ -184,7 +184,7 @@ export default HiddenMessage
184
184
import ' @testing-library/jest-dom'
185
185
// NOTE: jest-dom adds handy assertions to Jest and is recommended, but not required
186
186
187
- import React from ' react'
187
+ import * as React from ' react'
188
188
import {render , fireEvent , screen } from ' @testing-library/react'
189
189
import HiddenMessage from ' ../hidden-message'
190
190
@@ -209,7 +209,7 @@ test('shows the children when the checkbox is checked', () => {
209
209
210
210
``` jsx
211
211
// login.js
212
- import React from ' react'
212
+ import * as React from ' react'
213
213
214
214
function Login () {
215
215
const [state , setState ] = React .useReducer ((s , a ) => ({... s, ... a}), {
@@ -233,9 +233,7 @@ function Login() {
233
233
password: passwordInput .value ,
234
234
}),
235
235
})
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))))
239
237
.then (
240
238
user => {
241
239
setState ({loading: false , resolved: true , error: null })
@@ -276,15 +274,15 @@ export default Login
276
274
// again, these first two imports are something you' d normally handle in
277
275
// your testing framework configuration rather than importing them in every file.
278
276
import ' @testing-library/jest-dom'
279
- import React from ' react'
277
+ import * as React from ' react'
280
278
// import API mocking utilities from Mock Service Worker.
281
279
import {rest } from ' msw'
282
280
import {setupServer } from ' msw/node'
283
281
// import testing utilities
284
282
import {render , fireEvent , screen } from ' @testing-library/react'
285
283
import Login from ' ../login'
286
284
287
- const fakeUserResponse = { token: ' fake_user_token' }
285
+ const fakeUserResponse = {token: ' fake_user_token' }
288
286
const server = setupServer (
289
287
rest .post (' /api/login' , (req , res , ctx ) => {
290
288
return res (ctx .json (fakeUserResponse))
@@ -400,8 +398,8 @@ principles:
400
398
` react- dom` .
401
399
3. Utility implementations and APIs should be simple and flexible.
402
400
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.
405
403
406
404
## Docs
407
405
@@ -410,8 +408,7 @@ light-weight, simple, and easy to understand.
410
408
411
409
## Issues
412
410
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.
415
412
416
413
### 🐛 Bugs
417
414
@@ -607,6 +604,7 @@ Thanks goes to these people ([emoji key][emojis]):
607
604
608
605
<!-- markdownlint-enable -->
609
606
<!-- prettier-ignore-end -->
607
+
610
608
<!-- ALL-CONTRIBUTORS-LIST:END -->
611
609
612
610
This project follows the [all-contributors][all-contributors] specification.
0 commit comments