Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,160 --> 00:00:04,980
But of course there is another important question;
2
00:00:04,980 --> 00:00:08,650
we now have I have a rough idea of why we need tests
3
00:00:08,650 --> 00:00:11,550
and we know that tests are code
4
00:00:11,550 --> 00:00:14,420
that then tests our Abra code,
5
00:00:14,420 --> 00:00:16,440
but where do we write this code
6
00:00:16,440 --> 00:00:19,473
and how do we execute this testing code?
7
00:00:20,480 --> 00:00:24,930
For this, we need some extra tools and an extra setup.
8
00:00:24,930 --> 00:00:27,590
And um, specifically we need a tool
9
00:00:27,590 --> 00:00:29,680
for running our testing code
10
00:00:29,680 --> 00:00:32,320
and for asserting the results.
11
00:00:32,320 --> 00:00:36,310
So for determining whether some result can be seen
12
00:00:36,310 --> 00:00:40,910
as a success, or if a test failed with a given result,
13
00:00:40,910 --> 00:00:43,290
we need a tool that does debt.
14
00:00:43,290 --> 00:00:46,800
And then in our react app, we also need a way
15
00:00:46,800 --> 00:00:51,730
of simulating of rendering our react app and components
16
00:00:51,730 --> 00:00:56,730
for those automated tests to then interact with them.
17
00:00:56,820 --> 00:01:00,023
So we need to simulate the browser, so to say.
18
00:01:00,910 --> 00:01:04,810
Now, for the first part for running our testing code
19
00:01:04,810 --> 00:01:08,960
and asserting the results, we typically use Jest.
20
00:01:08,960 --> 00:01:11,090
It's not the only tool for this job
21
00:01:11,090 --> 00:01:14,530
but it's very popular, especially for react
22
00:01:14,530 --> 00:01:16,800
and it's easy to use.
23
00:01:16,800 --> 00:01:20,240
Now for simulating and rendering our components
24
00:01:20,240 --> 00:01:21,500
and the react app,
25
00:01:21,500 --> 00:01:25,780
we typically use the react testing library these days.
26
00:01:25,780 --> 00:01:29,570
And both these tools are already installed
27
00:01:29,570 --> 00:01:31,250
and set up for you,
28
00:01:31,250 --> 00:01:33,010
when you work in a project
29
00:01:33,010 --> 00:01:36,300
created with create react app.
30
00:01:36,300 --> 00:01:38,780
Here, I got such an example, project.
31
00:01:38,780 --> 00:01:41,310
You'll also fined this project attached
32
00:01:41,310 --> 00:01:44,640
and in there we'll have a look at the code later.
33
00:01:44,640 --> 00:01:47,110
If we have a look at package jason
34
00:01:47,110 --> 00:01:50,470
we see those testing library packages,
35
00:01:50,470 --> 00:01:52,850
which are part of this project.
36
00:01:52,850 --> 00:01:54,900
And I did not install those.
37
00:01:54,900 --> 00:01:59,290
They were part of a newly created react project,
38
00:01:59,290 --> 00:02:02,890
created with create react app automatically;
39
00:02:02,890 --> 00:02:04,133
out of the box.
40
00:02:05,010 --> 00:02:08,190
Now, what we don't see here is jest
41
00:02:08,190 --> 00:02:12,620
we only see this jest-dom testing library, sub package
42
00:02:12,620 --> 00:02:14,550
but I can tell you that it's also
43
00:02:14,550 --> 00:02:18,090
part of this project, just as a dependency
44
00:02:18,090 --> 00:02:21,680
of one of those other dependencies, basically.
45
00:02:21,680 --> 00:02:24,620
And therefore, in such a brand new project
46
00:02:24,620 --> 00:02:26,760
like the one which you find attached,
47
00:02:26,760 --> 00:02:31,110
everything is already set up for you to run your tests,
48
00:02:31,110 --> 00:02:33,250
and therefore that's what we're going to do next.
49
00:02:33,250 --> 00:02:35,450
We're going to run our first test
50
00:02:35,450 --> 00:02:37,353
and understand how that works.
3910
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.