WEBVTT

00:00.350 --> 00:04.330
So now we have a guitar file that just gets the HTML.

00:04.370 --> 00:08.000
We just wrote that now and we got the HTML.

00:08.760 --> 00:15.240
And now we need to build out our parser, which is getting the actual data from this HTML.

00:15.660 --> 00:22.380
A nice side effect about having this test driven development is that you get a separation of concerns

00:22.380 --> 00:23.490
in your code.

00:23.550 --> 00:30.570
So all you get, you're more likely to have separation of concerns because you need to test one thing

00:30.570 --> 00:31.640
at a time.

00:31.710 --> 00:37.260
So here we have now only a getter for the HTML, which is just getting the HTML.

00:37.350 --> 00:42.650
And then we are also having a parser instead of having it all inside one file.

00:42.660 --> 00:48.510
And for maintainability and readability, this is actually a pretty good thing.

00:48.810 --> 00:53.580
So that's one of the advantages of having test driven development.

00:53.610 --> 00:59.670
Now on to what you guys are here to see, which is to write the test for the parser.

01:00.720 --> 01:10.980
So first we have a before all function that you can use inside of chest, which is going to be run before

01:10.980 --> 01:12.720
it runs all the test.

01:13.710 --> 01:23.390
So in here you can declare variables that you want to use inside all of the tests, such as a HTML variable

01:23.400 --> 01:24.870
you might want to save.

01:25.200 --> 01:33.510
So we can say let HTML, just declare the variable up in the global scope up here and then we can say

01:33.750 --> 01:39.510
HTML equals and then we need to import FS to read a file.

01:42.170 --> 01:51.800
So then we can say FS read file sync and then passed in the test dot HTML file path here.

01:51.800 --> 01:59.780
And then we have a nice big string basically inside of HTML, which is exactly what we can use inside

01:59.780 --> 02:02.900
of Mario or inside our passengers.

02:03.500 --> 02:07.790
So now we have the now it says test not found.

02:07.790 --> 02:09.860
So maybe just with dot test.

02:09.860 --> 02:11.390
It seems to work now.

02:11.720 --> 02:18.860
So let's go into yarn run test, see how our test is running.

02:20.370 --> 02:26.700
We still have our Add two plus two test, which is running, but now we need to write out another test

02:26.700 --> 02:27.840
for the HTML.
