@@ -451,12 +451,12 @@ expect(submitButton).toBeNull() // it doesn't exist
451
451
## Examples
452
452
453
453
You ' ll find examples of testing with different libraries in
454
- [the test directory ](https :// github.com/kentcdodds/react-testing-library/blob/master/src/__tests__ ).
454
+ [the ` examples ` directory ](https :// github.com/kentcdodds/react-testing-library/blob/master/examples ).
455
455
Some included are :
456
456
457
- * [` react-redux ` ](https :// github.com/kentcdodds/react-testing-library/blob/master/src /__tests__/react-redux.js)
458
- * [` react-router ` ](https :// github.com/kentcdodds/react-testing-library/blob/master/src /__tests__/react-router.js)
459
- * [` react-context ` ](https :// github.com/kentcdodds/react-testing-library/blob/master/src /__tests__/react-context.js)
457
+ * [` react-redux ` ](https :// github.com/kentcdodds/react-testing-library/blob/master/examples /__tests__/react-redux.js)
458
+ * [` react-router ` ](https :// github.com/kentcdodds/react-testing-library/blob/master/examples /__tests__/react-router.js)
459
+ * [` react-context ` ](https :// github.com/kentcdodds/react-testing-library/blob/master/examples /__tests__/react-context.js)
460
460
461
461
Examples of TDD with react - testing - library :
462
462
@@ -541,7 +541,7 @@ render(<NumberDisplay number={2} />, {container})
541
541
expect(getByTestId('number-display').textContent).toBe('2')
542
542
` ` `
543
543
544
- [Open the tests ](https : // github.com/kentcdodds/react-testing-library/blob/master/src /__tests__/number-display .js)
544
+ [Open the tests ](https : // github.com/kentcdodds/react-testing-library/blob/master/examples /__tests__/update-props .js)
545
545
for a full example of this .
546
546
547
547
</details >
@@ -584,7 +584,7 @@ test('you can mock things with jest.mock', () => {
584
584
Note that because they ' re Jest mock functions (`jest.fn()`), you could also make
585
585
assertions on those as well if you wanted .
586
586
587
- [Open full test ](https :// github.com/kentcdodds/react-testing-library/blob/master/src /__tests__/mock.react-transition-group.js)
587
+ [Open full test ](https :// github.com/kentcdodds/react-testing-library/blob/master/examples /__tests__/mock.react-transition-group.js)
588
588
for the full example .
589
589
590
590
This looks like more work that shallow rendering (and it is ), but it gives you
@@ -593,7 +593,7 @@ enough.
593
593
594
594
If you want to make things more like shallow rendering , then you could do
595
595
something more
596
- [like this ](https :// github.com/kentcdodds/react-testing-library/blob/master/src /__tests__/shallow.react-transition-group.js).
596
+ [like this ](https :// github.com/kentcdodds/react-testing-library/blob/master/examples /__tests__/shallow.react-transition-group.js).
597
597
598
598
Learn more about how Jest mocks work from my blog post :
599
599
[" But really, what is a JavaScript mock?" ](https :// blog.kentcdodds.com/but-really-what-is-a-javascript-mock-10d060966f7d)
@@ -754,11 +754,13 @@ light-weight, simple, and understandable.
754
754
Thanks goes to these people ([emoji key ][emojis ]):
755
755
756
756
<!-- ALL -CONTRIBUTORS -LIST : START - Do not remove or modify this section -->
757
+
757
758
<!-- prettier -ignore -->
758
759
| [<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") |
759
760
| : ---: | : ---: | : ---: | : ---: | : ---: | : ---: | : ---: |
760
761
| [<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") |
761
762
| [<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") |
763
+
762
764
<!-- ALL -CONTRIBUTORS -LIST : END -->
763
765
764
766
This project follows the [all -contributors ][all -contributors ] specification .
0 commit comments