Now, let's create a new file inside of test and let's call it let's call it parser the test that James.
And then let's write out a contest parser and then let's say require.
And then we go up one directory into the root directory where we have where we create a new file, we
call it parser that is.
And then it's important file here, so we have parser with two dots because we go one directory up and.
So in here, we can ride the test itself.
Usually you can ride the test out like something with the IT word and then you can ride it should.
Give for so then you can call a method in here and test it out so we can do a function, call here and
call, for example, and we can say consed result equals Peiser that at and then we can pass into some
variables, for example, two and two.
And then we say we expect the result to be.
Four million, so that's our first test that we just written here, where we test the atmosphere inside
of parser.
Now notice that we've written out the test first here.
We haven't written out the code yet.
That's what you mean when you say test driven development or TDD.
And it's really nice to do this with scraping, because it means we're not going to hit the website
as we're developing our scraper anyway onto this little example we have here for adding let's try and
run our test now and we should see a test that is fading now.
So we see yarn run test.
Remember, test is what we have inside of the package to chasten with the scripts.
And then we have test in here so you can run test is essentially going to run just that virtual.
Let's see how it works.
So we'll see you on one test.
And now it's this one test suit or one test has failed and it says pass the dart at.
It's not a function, which is true because there's no functions at all instead of possible.
So that's the reason why we also write out the test before we write the code, is to basically make
sure that the code is more testable before you write the code.
And secondly, we also ensure that the test is actually working instead of us riding out the test and
the test goes green, even though the test is not actually working.
So that's why you want to see a failing test first and then you want to write out the code to make the
test pass, because then you know that the test is working because it started out by failing.
If it just starts out by going green right now, even though I haven't written the test or written the
code yet, I would know something is wrong with this test.