Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,210 --> 00:00:03,990
Now that's it for this module,
2
00:00:03,990 --> 00:00:06,880
which is only an introduction to testing
3
00:00:06,880 --> 00:00:09,250
or to testing React apps.
4
00:00:09,250 --> 00:00:11,700
Now, testing as I mentioned at the beginning
5
00:00:11,700 --> 00:00:15,910
is definitely a topic an entire course could be created on.
6
00:00:15,910 --> 00:00:18,540
But this course is not about that.
7
00:00:18,540 --> 00:00:20,680
It's about React and therefore I want
8
00:00:20,680 --> 00:00:23,150
to introduce you to React testing.
9
00:00:23,150 --> 00:00:26,020
I don't want to include an entire testing course
10
00:00:26,020 --> 00:00:27,803
into this course as well.
11
00:00:28,780 --> 00:00:30,610
Now, if you want to learn more about testing,
12
00:00:30,610 --> 00:00:33,360
of course there are dedicated tutorials and courses
13
00:00:33,360 --> 00:00:34,520
you can check out.
14
00:00:34,520 --> 00:00:36,837
But what's also definitely worth a look,
15
00:00:36,837 --> 00:00:39,443
are the official docs of Jest.
16
00:00:39,443 --> 00:00:41,040
This tool we used under the hood
17
00:00:41,040 --> 00:00:44,130
for running our tests and for asserting the results
18
00:00:44,130 --> 00:00:47,133
and the docs of the React testing library.
19
00:00:48,170 --> 00:00:49,500
Now let's start with Jest.
20
00:00:49,500 --> 00:00:52,000
If you Google for Jest you find these official docs
21
00:00:52,000 --> 00:00:54,900
and these docs aren't too bad.
22
00:00:54,900 --> 00:00:57,660
Now, keep in mind that all these setup steps here
23
00:00:57,660 --> 00:01:00,910
are not required by you because in our React project
24
00:01:00,910 --> 00:01:02,610
you already have a setup.
25
00:01:02,610 --> 00:01:04,340
And also keep in mind here,
26
00:01:04,340 --> 00:01:09,120
that Jest is not a tool focused on just React.
27
00:01:09,120 --> 00:01:12,440
It's a general JavaScript testing tool,
28
00:01:12,440 --> 00:01:15,350
and therefore the docs represent that.
29
00:01:15,350 --> 00:01:16,970
But still here, you can learn more
30
00:01:16,970 --> 00:01:19,360
about the different matchers, which you have,
31
00:01:19,360 --> 00:01:22,720
the different ways of expressing expectations.
32
00:01:22,720 --> 00:01:25,900
You can learn more about testing async code.
33
00:01:25,900 --> 00:01:30,270
How you can wait for promises to complete, if you want that.
34
00:01:30,270 --> 00:01:32,660
You can learn more about mocking functions,
35
00:01:32,660 --> 00:01:35,300
something we also did in this module.
36
00:01:35,300 --> 00:01:37,460
Here you can dive deeper and learn more
37
00:01:37,460 --> 00:01:39,890
about the possibilities you've got there,
38
00:01:39,890 --> 00:01:42,130
for mocking regular functions.
39
00:01:42,130 --> 00:01:45,610
And also of course, for mocking promises,
40
00:01:45,610 --> 00:01:48,160
as we did it here as well.
41
00:01:48,160 --> 00:01:50,480
You can learn more here and in general.
42
00:01:50,480 --> 00:01:52,920
Check out these different guides here to learn
43
00:01:52,920 --> 00:01:55,880
about the different examples and the different features
44
00:01:55,880 --> 00:01:57,653
this tool has to offer.
45
00:01:58,880 --> 00:02:01,190
Now, when it comes to testing React
46
00:02:01,190 --> 00:02:04,740
you want to check out the React Testing Library docs.
47
00:02:04,740 --> 00:02:08,570
These docs are also great, and in there you learn way more
48
00:02:08,570 --> 00:02:11,710
about testing React with that library.
49
00:02:11,710 --> 00:02:14,900
You also find a complete example here,
50
00:02:14,900 --> 00:02:17,150
which could be interesting to check out.
51
00:02:17,150 --> 00:02:21,110
You find the complete API, which you have available.
52
00:02:21,110 --> 00:02:23,470
Also check out the core API here to learn
53
00:02:23,470 --> 00:02:25,280
about these different query methods.
54
00:02:25,280 --> 00:02:28,320
GetBy, findBy, queryBy.
55
00:02:28,320 --> 00:02:31,690
You also get the differences explained here again.
56
00:02:31,690 --> 00:02:34,540
You also learn more about firing user events here.
57
00:02:34,540 --> 00:02:36,770
You'll learn more about async code here,
58
00:02:36,770 --> 00:02:40,790
and therefore that definitely also is a documentation
59
00:02:40,790 --> 00:02:43,570
that is worth a closer look if you are serious
60
00:02:43,570 --> 00:02:46,290
about testing React apps.
61
00:02:46,290 --> 00:02:51,190
I especially also want to highlight the ecosystem part here.
62
00:02:51,190 --> 00:02:54,850
Where you learn about extensions, that you can install.
63
00:02:54,850 --> 00:02:57,240
Some of these extensions already are part
64
00:02:57,240 --> 00:03:00,840
of a default project set up in a React app.
65
00:03:00,840 --> 00:03:05,720
For example, the user-event extension.
66
00:03:05,720 --> 00:03:08,160
But I especially also want to highlight one extension,
67
00:03:08,160 --> 00:03:09,830
which is not listed here.
68
00:03:09,830 --> 00:03:13,700
And that is the React-hooks-testing-library extension,
69
00:03:13,700 --> 00:03:17,850
which makes testing React hooks especially custom hooks,
70
00:03:17,850 --> 00:03:19,073
way easier.
71
00:03:19,970 --> 00:03:22,240
Here you can learn how to use that extension
72
00:03:22,240 --> 00:03:24,010
in case you have custom book functions,
73
00:03:24,010 --> 00:03:25,350
which you want to test.
74
00:03:25,350 --> 00:03:28,210
Which of course, typically do want to test
75
00:03:28,210 --> 00:03:31,860
because you should test your entire code base if possible.
76
00:03:31,860 --> 00:03:35,050
And therefore these are resources you can dive
77
00:03:35,050 --> 00:03:37,360
in as a next step, but I hope
78
00:03:37,360 --> 00:03:40,880
that this course module gets you started with testing
79
00:03:40,880 --> 00:03:43,410
and you now at least have a general idea
80
00:03:43,410 --> 00:03:45,223
of how that all works.
6339
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.