├── .gitignore
├── README.md
├── package.json
└── src
├── __tests__
└── index.test.js
├── index.js
└── setupTests.js
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | *.log
3 | yarn.lock
4 | package-lock.json
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Testing Library Reproduction Template
2 |
3 | Template repository for bug reports to @testing-library/dom,
4 | @testing-library/react, and @testing-library/jest-dom
5 |
6 | You can also [use this on codesandbox](http://codesandbox.io/s/github/testing-library/dom-testing-library-template)
7 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "dom-testing-library-template",
3 | "version": "1.0.0",
4 | "description": "Template for dom-testing-library bug reproduction",
5 | "license": "MIT",
6 | "author": "alexkrolick",
7 | "main": "src/index.js",
8 | "scripts": {
9 | "test": "react-scripts test"
10 | },
11 | "eslintConfig": {
12 | "extends": "react-app"
13 | },
14 | "dependencies": {
15 | "@testing-library/dom": "latest",
16 | "@testing-library/jest-dom": "latest",
17 | "@testing-library/react": "latest",
18 | "jest": "latest",
19 | "react": "latest",
20 | "react-dom": "latest",
21 | "react-scripts": "latest"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/__tests__/index.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import {render, fireEvent} from '@testing-library/react'
3 | import Counter from '../'
4 |
5 | test('increments the count', () => {
6 | const {getByText} = render()
7 | const button = getByText('0')
8 | fireEvent.click(button)
9 | expect(button).toHaveTextContent('1')
10 | fireEvent.click(button)
11 | expect(button).toHaveTextContent('2')
12 | })
13 |
14 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | function Counter() {
4 | const [count, setCount] = React.useState(0)
5 | const increment = () => setCount(c => c + 1)
6 | return
7 | }
8 |
9 | export default Counter
--------------------------------------------------------------------------------
/src/setupTests.js:
--------------------------------------------------------------------------------
1 | import '@testing-library/jest-dom/extend-expect'
--------------------------------------------------------------------------------