Instructor: Normally when introducing a complex topic
such as testing, I like to do a long discussion
about the purpose of testing, the history,
some of the different methods, and so on.
I found over practice, though, that jumping right in
to some examples when working with testing
tends to be a little bit more useful
as you're just starting to learn.
So we're gonna go ahead and start
by cloning a starter repository,
walk through a couple code examples,
and then we'll dive right back in
to the theory and purpose of testing.
So to get started, I'm gonna open up my browser
and navigate to the existing GitHub repo.
I can get there by visiting
github.com/stephengrider/reduxsimplestarter.
And once I'm here, I can either clone the repo,
if you're familiar with Git.
There's also directions on how to get started
if you're not familiar with Git.
So either way, don't sweat it, got you covered.
I'm gonna go ahead and use Git.
So I'm gonna copy the link up here,
paste it in with a Git clone,
and I'm gonna clone this into a directory called "testing."
Next, I'll change into that directory,
and I'll do an NPM install.
So while this is running,
I'm gonna go ahead and open up my code editor too.
So we can do a little bit of glance through
on the existing code base here
while we're installing dependencies.
So in this directory, or in this project,
you'll see three separate files, source, style, and test.
Source has a kind of a skeleton, or boiler plate,
of a project already wired up with Redux in here.
So we've got an index file for actions,
we've got some components,
and we've at least got the stub for some reducers.
You'll also find a stub of a style.css in here.
Not really useful for us,
but what is really interesting and useful
is this test directory.
So we're gonna be writing a whole array
of different tests inside of this directory right here,
and we're gonna see it grow over time.
In this directory in particular,
you'll already see two files in here.
One is the test helper, let's open that up.
And in here I've already put together a whole bunch
of configuration for our testing suite.
Now it's definitely my intent to walk you through
putting together your own testing setup.
So at the end of this section, we're gonna delete this file,
and rewrite it all from scratch.
But when you're just getting started with testing
it's a little bit of a nightmare
to walk through the first time.
So let's first learn a little bit about testing
and then worry about doing the initial setup.
We've also got an initial spec file in here.
You'll see "describe," some stuff, you'll see "it" in here.
And then "expect," something, something, something.
So this is kind of a first test in here
that we've already got included.
It's just kind of a mock of a test,
not really testing a whole lot right now.
And we're definitely going to expand upon this
and walk through each step of this spec in great detail.
Flipping back over to my command line,
it looks like my dependencies are all done installing,
so I will go ahead and catch you in the next section
when yours are done installing as well.