Skip to content

Commit 3c1d142

Browse files
author
Kent C. Dodds
committed
other things
1 parent a4a0837 commit 3c1d142

32 files changed

+96
-164
lines changed

README.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,35 @@ _Course material for testing React components using react-testing-library_
77

88
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
99

10-
I'm still working on the README. But here's the order these should be given in:
11-
1210
- `react-dom.js` - Render a React component for testing
1311
- `jest-dom.js` - Use jest-dom for improved assertions
14-
- `dom-testing-library.js` - Use dom-testing-library to write more maintainable React tests
15-
- `react-testing-library.js` - Use react-testing-library to render and test React Components
12+
- `dom-testing-library.js` - Use dom-testing-library to write more maintainable
13+
React tests
14+
- `react-testing-library.js` - Use react-testing-library to render and test
15+
React Components
1616
- `localized.js` - Testing localized content with react-testing-library
1717
- `state.js` - Test React Component state changes with react-testing-library
1818
- `prop-updates.js` - Test prop updates with react-testing-library
1919
- `a11y.js` - Test accessibility of rendered React Components with jest-axe
20-
- `dependency-injection.js` - Mock HTTP Requests with Dependency Injection in React Component Tests
21-
- `http-jest-mock.js` - Mock HTTP Requests with jest.mock in React Component Tests
22-
- `mock-component.js` - Mock react-transition-group in React Component Tests with jest.mock
23-
- `error-boundaries.js` - Test componentDidCatch handler error boundaries with react-testing-library
24-
- `tdd-markup.js` - Test drive the development of a React Form with react-testing-library
25-
- `tdd-functionality.js` - TDD the functionality of a React Form with react-testing-library
26-
- `react-router-provider.js` - Test react-router Provider history object in React Component Tests with createMemoryHistory
20+
- `dependency-injection.js` - Mock HTTP Requests with Dependency Injection in
21+
React Component Tests
22+
- `http-jest-mock.js` - Mock HTTP Requests with jest.mock in React Component
23+
Tests
24+
- `mock-component.js` - Mock react-transition-group in React Component Tests
25+
with jest.mock
26+
- `error-boundaries.js` - Test componentDidCatch handler error boundaries with
27+
react-testing-library
28+
- `tdd-markup.js` - Test drive the development of a React Form with
29+
react-testing-library
30+
- `tdd-functionality.js` - TDD the functionality of a React Form with
31+
react-testing-library
32+
- `react-router-provider.js` - Test react-router Provider history object in
33+
React Component Tests with createMemoryHistory
2734
- `redux.js` - Test a redux connected React Component
2835
- `render-props.js` - Test a render prop component using a Jest spy function
2936
- `portals.js` - Test React portals with react-testing-library’s `within` API
3037
- `unmounting.js` - Test Unmounting a React Component with react-testing-library
38+
39+
> Note: the setup for this project uses kcd-scripts. Don't worry about that. You
40+
> can learn about how to configure jest properly in the "Configure Jest for
41+
> Testing JavaScript Applications" module of TestingJavaScript.com

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"description": "Course material for testing React components using react-testing-library",
66
"main": "index.js",
77
"scripts": {
8-
"test": "jest --coverage",
9-
"test:watch": "jest --watch",
8+
"test": "kcd-scripts test --coverage",
9+
"test:watch": "kcd-scripts test --watch",
1010
"lint": "kcd-scripts lint",
1111
"validate": "kcd-scripts validate",
1212
"setup": "npm install --silent && npm run validate --silent"
@@ -50,7 +50,8 @@
5050
"react/prop-types": "off",
5151
"import/no-unassigned-import": "off",
5252
"no-console": "off",
53-
"jsx-a11y/accessible-emoji": "off"
53+
"jsx-a11y/accessible-emoji": "off",
54+
"consistent-return": "off"
5455
}
5556
},
5657
"eslintIgnore": [
@@ -65,7 +66,8 @@
6566
"singleQuote": true,
6667
"trailingComma": "all",
6768
"bracketSpacing": false,
68-
"jsxBracketSameLine": false
69+
"jsxBracketSameLine": false,
70+
"proseWrap": "always"
6971
},
7072
"repository": {
7173
"type": "git",

src/__tests__/dependency-injection.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
// these should normally be in your jest setupFilesAfterEnv
2-
import '@testing-library/jest-dom/extend-expect'
3-
import '@testing-library/react/cleanup-after-each'
4-
51
import React from 'react'
62
import {render, fireEvent, wait} from '@testing-library/react'
73
import {GreetingLoader} from '../greeting-loader-02-dependency-injection'

src/__tests__/dom-testing-library.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import '@testing-library/jest-dom/extend-expect'
21
import React from 'react'
32
import ReactDOM from 'react-dom'
43
import {getQueriesForElement} from '@testing-library/dom'

src/__tests__/error-boundary.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// these should normally be in your jest setupFilesAfterEnv
22
import '@testing-library/react/cleanup-after-each'
3-
import '@testing-library/jest-dom/extend-expect'
43

54
import React from 'react'
65
import {render, fireEvent} from '@testing-library/react'

src/__tests__/http-jest-mock.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
// these should normally be in your jest setupFilesAfterEnv
2-
import '@testing-library/jest-dom/extend-expect'
3-
import '@testing-library/react/cleanup-after-each'
4-
51
import React from 'react'
62
import {render, fireEvent, wait} from '@testing-library/react'
73
import {loadGreeting as mockLoadGreeting} from '../api'

src/__tests__/jest-dom.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import '@testing-library/jest-dom/extend-expect'
21
import React from 'react'
32
import ReactDOM from 'react-dom'
43
import {FavoriteNumber} from '../favorite-number'

src/__tests__/mock-component.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
// these should normally be in your jest setupFilesAfterEnv
2-
import '@testing-library/jest-dom/extend-expect'
3-
import '@testing-library/react/cleanup-after-each'
4-
51
import React from 'react'
62
import {render, fireEvent} from '@testing-library/react'
73
import {HiddenMessage} from '../hidden-message'

src/__tests__/portals.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
// these should normally be in your jest setupFilesAfterEnv
2-
import '@testing-library/jest-dom/extend-expect'
3-
import '@testing-library/react/cleanup-after-each'
4-
51
import React from 'react'
62
import {render} from '@testing-library/react'
73
import {Modal} from '../modal'

src/__tests__/prop-updates.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import '@testing-library/jest-dom/extend-expect'
2-
import '@testing-library/react/cleanup-after-each'
31
import React from 'react'
42
import {render, fireEvent} from '@testing-library/react'
53
import {FavoriteNumber} from '../favorite-number'

0 commit comments

Comments
 (0)