1 00:00:02,070 --> 00:00:05,220 So we learned that testing might make sense, 2 00:00:05,220 --> 00:00:07,170 how do we test then? 3 00:00:07,530 --> 00:00:13,370 We need two tools to write good tests and be able to test our react application. 4 00:00:13,410 --> 00:00:16,270 The first tool is the test runner, 5 00:00:16,350 --> 00:00:20,690 this is basically a tool which is responsible for executing our tests 6 00:00:20,730 --> 00:00:27,720 so for running the code, test code and providing a validation library which in the end is a library which allows 7 00:00:27,720 --> 00:00:31,610 us to do comparations and potentially throw some errors. 8 00:00:31,650 --> 00:00:38,700 The idea behind unit tests is that they don't run in the browser but instead with nodeJS though often 9 00:00:38,760 --> 00:00:45,530 emulated to be in a browser environment with the help of specific javascript packages. The test runner 10 00:00:45,580 --> 00:00:50,360 then is the core tool which simply executes our code using that environment 11 00:00:50,520 --> 00:00:55,140 and the good thing is create react app already comes with a pre-configured testing environment 12 00:00:55,140 --> 00:00:56,510 we can build up on. 13 00:00:56,850 --> 00:01:02,490 So that's the test runner and we will use jest in this course, jest is already installed in the app 14 00:01:02,490 --> 00:01:08,460 created with create react app and is a popular javascript testing tool which is not limited to react 15 00:01:08,490 --> 00:01:15,450 but often used in react apps. Now running the test is one thing, when working with reacting components, 16 00:01:15,450 --> 00:01:22,380 we also need a way of emulating these components, so basically mounting them to some non-existent dom you 17 00:01:22,380 --> 00:01:28,350 could say and then traversing our components and we want to do this in an efficient quick way without 18 00:01:28,350 --> 00:01:34,340 having to actually create that whole component tree which might also introduce some side effects. 19 00:01:34,680 --> 00:01:42,030 For this, we need testing utilities which help us with testing and there, we specifically need the just 20 00:01:42,030 --> 00:01:48,510 described help to simulate the react app, mount components and dig into that dom which is created with react. 21 00:01:49,230 --> 00:01:55,680 In this course we could you as react test utils, that's the official utility tool but there's another tool 22 00:01:55,680 --> 00:02:01,160 which became more and more important and interesting and is also suggested by the react team 23 00:02:01,260 --> 00:02:04,980 amd that's enzyme. Enzyme is a tool developed by AirBnB, 24 00:02:04,980 --> 00:02:11,400 they use react in a lot of their projects and they share this tool which makes it easy to mount components 25 00:02:11,610 --> 00:02:13,480 and then navigate through them 26 00:02:13,530 --> 00:02:18,710 and I will of course show you how to use both tools, jest and enzyme in this course. 27 00:02:18,720 --> 00:02:24,450 So these are the testing tools, that leaves us only with one question, what should we test?