@@ -456,12 +456,12 @@ expect(submitButton).toBeNull() // it doesn't exist
456
456
## Examples
457
457
458
458
You ' ll find examples of testing with different libraries in
459
- [the test directory ](https :// github.com/kentcdodds/react-testing-library/blob/master/src/__tests__ ).
459
+ [the ` examples ` directory ](https :// github.com/kentcdodds/react-testing-library/blob/master/examples ).
460
460
Some included are :
461
461
462
- * [` react-redux ` ](https :// github.com/kentcdodds/react-testing-library/blob/master/src /__tests__/react-redux.js)
463
- * [` react-router ` ](https :// github.com/kentcdodds/react-testing-library/blob/master/src /__tests__/react-router.js)
464
- * [` react-context ` ](https :// github.com/kentcdodds/react-testing-library/blob/master/src /__tests__/react-context.js)
462
+ * [` react-redux ` ](https :// github.com/kentcdodds/react-testing-library/blob/master/examples /__tests__/react-redux.js)
463
+ * [` react-router ` ](https :// github.com/kentcdodds/react-testing-library/blob/master/examples /__tests__/react-router.js)
464
+ * [` react-context ` ](https :// github.com/kentcdodds/react-testing-library/blob/master/examples /__tests__/react-context.js)
465
465
466
466
Examples of TDD with react - testing - library :
467
467
@@ -546,7 +546,7 @@ render(<NumberDisplay number={2} />, {container})
546
546
expect(getByTestId('number-display').textContent).toBe('2')
547
547
` ` `
548
548
549
- [Open the tests ](https : // github.com/kentcdodds/react-testing-library/blob/master/src /__tests__/number-display .js)
549
+ [Open the tests ](https : // github.com/kentcdodds/react-testing-library/blob/master/examples /__tests__/update-props .js)
550
550
for a full example of this .
551
551
552
552
</details >
@@ -589,7 +589,7 @@ test('you can mock things with jest.mock', () => {
589
589
Note that because they ' re Jest mock functions (`jest.fn()`), you could also make
590
590
assertions on those as well if you wanted .
591
591
592
- [Open full test ](https :// github.com/kentcdodds/react-testing-library/blob/master/src /__tests__/mock.react-transition-group.js)
592
+ [Open full test ](https :// github.com/kentcdodds/react-testing-library/blob/master/examples /__tests__/mock.react-transition-group.js)
593
593
for the full example .
594
594
595
595
This looks like more work that shallow rendering (and it is ), but it gives you
@@ -598,7 +598,7 @@ enough.
598
598
599
599
If you want to make things more like shallow rendering , then you could do
600
600
something more
601
- [like this ](https :// github.com/kentcdodds/react-testing-library/blob/master/src /__tests__/shallow.react-transition-group.js).
601
+ [like this ](https :// github.com/kentcdodds/react-testing-library/blob/master/examples /__tests__/shallow.react-transition-group.js).
602
602
603
603
Learn more about how Jest mocks work from my blog post :
604
604
[" But really, what is a JavaScript mock?" ](https :// blog.kentcdodds.com/but-really-what-is-a-javascript-mock-10d060966f7d)
@@ -759,13 +759,11 @@ light-weight, simple, and understandable.
759
759
Thanks goes to these people ([emoji key ][emojis ]):
760
760
761
761
<!-- ALL -CONTRIBUTORS -LIST : START - Do not remove or modify this section -->
762
-
763
762
<!-- prettier -ignore -->
764
763
| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub><b>Kent C. Dodds</b></sub>](https://kentcdodds.com)<br />[💻](https://github.com/kentcdodds/react-testing-library/commits?author=kentcdodds "Code") [📖](https://github.com/kentcdodds/react-testing-library/commits?author=kentcdodds "Documentation") [🚇](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [⚠️](https://github.com/kentcdodds/react-testing-library/commits?author=kentcdodds "Tests") | [<img src="https://avatars1.githubusercontent.com/u/2430381?v=4" width="100px;"/><br /><sub><b>Ryan Castner</b></sub>](http://audiolion.github.io)<br />[📖](https://github.com/kentcdodds/react-testing-library/commits?author=audiolion "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/8008023?v=4" width="100px;"/><br /><sub><b>Daniel Sandiego</b></sub>](https://www.dnlsandiego.com)<br />[💻](https://github.com/kentcdodds/react-testing-library/commits?author=dnlsandiego "Code") | [<img src="https://avatars2.githubusercontent.com/u/12592677?v=4" width="100px;"/><br /><sub><b>Paweł Mikołajczyk</b></sub>](https://github.com/Miklet)<br />[💻](https://github.com/kentcdodds/react-testing-library/commits?author=Miklet "Code") | [<img src="https://avatars3.githubusercontent.com/u/464978?v=4" width="100px;"/><br /><sub><b>Alejandro Ñáñez Ortiz</b></sub>](http://co.linkedin.com/in/alejandronanez/)<br />[📖](https://github.com/kentcdodds/react-testing-library/commits?author=alejandronanez "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/1402095?v=4" width="100px;"/><br /><sub><b>Matt Parrish</b></sub>](https://github.com/pbomb)<br />[🐛](https://github.com/kentcdodds/react-testing-library/issues?q=author%3Apbomb "Bug reports") [💻](https://github.com/kentcdodds/react-testing-library/commits?author=pbomb "Code") [📖](https://github.com/kentcdodds/react-testing-library/commits?author=pbomb "Documentation") [⚠️](https://github.com/kentcdodds/react-testing-library/commits?author=pbomb "Tests") | [<img src="https://avatars1.githubusercontent.com/u/1288694?v=4" width="100px;"/><br /><sub><b>Justin Hall</b></sub>](https://github.com/wKovacs64)<br />[📦](#platform-wKovacs64 "Packaging/porting to new platform") |
765
764
| : ---: | : ---: | : ---: | : ---: | : ---: | : ---: | : ---: |
766
765
| [<img src="https://avatars1.githubusercontent.com/u/1241511?s=460&v=4" width="100px;"/><br /><sub><b>Anto Aravinth</b></sub>](https://github.com/antoaravinth)<br />[💻](https://github.com/kentcdodds/react-testing-library/commits?author=antoaravinth "Code") [⚠️](https://github.com/kentcdodds/react-testing-library/commits?author=antoaravinth "Tests") [📖](https://github.com/kentcdodds/react-testing-library/commits?author=antoaravinth "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/3462296?v=4" width="100px;"/><br /><sub><b>Jonah Moses</b></sub>](https://github.com/JonahMoses)<br />[📖](https://github.com/kentcdodds/react-testing-library/commits?author=JonahMoses "Documentation") | [<img src="https://avatars1.githubusercontent.com/u/4002543?v=4" width="100px;"/><br /><sub><b>Łukasz Gandecki</b></sub>](http://team.thebrain.pro)<br />[💻](https://github.com/kentcdodds/react-testing-library/commits?author=lgandecki "Code") [⚠️](https://github.com/kentcdodds/react-testing-library/commits?author=lgandecki "Tests") [📖](https://github.com/kentcdodds/react-testing-library/commits?author=lgandecki "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/498274?v=4" width="100px;"/><br /><sub><b>Ivan Babak</b></sub>](https://sompylasar.github.io)<br />[🐛](https://github.com/kentcdodds/react-testing-library/issues?q=author%3Asompylasar "Bug reports") [🤔](#ideas-sompylasar "Ideas, Planning, & Feedback") | [<img src="https://avatars3.githubusercontent.com/u/4439618?v=4" width="100px;"/><br /><sub><b>Jesse Day</b></sub>](https://github.com/jday3)<br />[💻](https://github.com/kentcdodds/react-testing-library/commits?author=jday3 "Code") | [<img src="https://avatars0.githubusercontent.com/u/15199?v=4" width="100px;"/><br /><sub><b>Ernesto García</b></sub>](http://gnapse.github.io)<br />[💬](#question-gnapse "Answering Questions") [💻](https://github.com/kentcdodds/react-testing-library/commits?author=gnapse "Code") [📖](https://github.com/kentcdodds/react-testing-library/commits?author=gnapse "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/2747424?v=4" width="100px;"/><br /><sub><b>Josef Maxx Blake</b></sub>](http://jomaxx.com)<br />[💻](https://github.com/kentcdodds/react-testing-library/commits?author=jomaxx "Code") [📖](https://github.com/kentcdodds/react-testing-library/commits?author=jomaxx "Documentation") [⚠️](https://github.com/kentcdodds/react-testing-library/commits?author=jomaxx "Tests") |
767
766
| [<img src="https://avatars1.githubusercontent.com/u/29602306?v=4" width="100px;"/><br /><sub><b>Michal Baranowski</b></sub>](https://twitter.com/baranovskim)<br />[📝](#blog-mbaranovski "Blogposts") [✅](#tutorial-mbaranovski "Tutorials") | [<img src="https://avatars3.githubusercontent.com/u/13985684?v=4" width="100px;"/><br /><sub><b>Arthur Puthin</b></sub>](https://github.com/aputhin)<br />[📖](https://github.com/kentcdodds/react-testing-library/commits?author=aputhin "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/21194045?v=4" width="100px;"/><br /><sub><b>Thomas Chia</b></sub>](https://github.com/thchia)<br />[💻](https://github.com/kentcdodds/react-testing-library/commits?author=thchia "Code") [📖](https://github.com/kentcdodds/react-testing-library/commits?author=thchia "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/20430611?v=4" width="100px;"/><br /><sub><b>Thiago Galvani</b></sub>](http://ilegra.com/)<br />[📖](https://github.com/kentcdodds/react-testing-library/commits?author=thiagopaiva99 "Documentation") | [<img src="https://avatars1.githubusercontent.com/u/19828824?v=4" width="100px;"/><br /><sub><b>Christian</b></sub>](http://Chriswcs.github.io)<br />[⚠️](https://github.com/kentcdodds/react-testing-library/commits?author=ChrisWcs "Tests") | [<img src="https://avatars3.githubusercontent.com/u/1571667?v=4" width="100px;"/><br /><sub><b>Alex Krolick</b></sub>](https://alexkrolick.com)<br />[💬](#question-alexkrolick "Answering Questions") [📖](https://github.com/kentcdodds/react-testing-library/commits?author=alexkrolick "Documentation") [💡](#example-alexkrolick "Examples") [🤔](#ideas-alexkrolick "Ideas, Planning, & Feedback") |
768
-
769
767
<!-- ALL -CONTRIBUTORS -LIST : END -->
770
768
771
769
This project follows the [all -contributors ][all -contributors ] specification .
0 commit comments