Instructor: So, we're all done with
our specs for our reducer
and we're also all done
with the implementation side as well.
All we need to do now is wire up the reducer
to our combineReducers call
inside of reducers, index.js.
Let's import our commentsReducer
from, excuse me, from comments.
And then we'll take out this kind of dummy reducer
that's sitting in here by default.
And replace it with just comments is coming from
commentsReducer.
We'll save, check our specs.
Everything is still green, very good.
I think that we're at a pretty good state
where we could go and test our code out in the browser.
Let's flip open the browser.
I'm gonna refresh the page
and we'll enter some text.
We'll say "New Comment" and we'll submit the comment
and sure enough, it gets added as a new ally.
So this is really fantastic.
It means that we built our entire feature
with maybe what, only one time
did we ever refresh this thing in the browser?
That would've been really hard to do
without having some tests to go along with this.
So it was solely by writing tests ahead of time
that we got to develop almost our entire feature
without ever really touching it inside the browser.
Now there's just one problem here.
The button right here is popping up next to the text area
which is really unsightly
and it would be really nice to have a title
at the top of this as well.
So let's go ahead and make that late game change.
We're gonna do this inside of our comment_box,
inside of the comments folder.
Inside the form, I'm gonna add on a,
how about just a h4 that says "Add a comment."
And I'm also gonna wrap my button with a div
just to force it onto a new line.
Okay, let's go and refresh.
Okay, so this looks a lot better.
Now we can say "That was a great article."
You know, let's assume this is an actual comment.
Or "That was a horrible article."
So also note that the text area is properly clearing out
when we submit the comment as well,
which is the behavior that we really wanted.
We can add more comments on here.
"Localhost is where we find this app."
Or any other comment you could possibly think of.
I'm a little bit tapped on comments at this point.
So this is pretty much the app in summary.
What I'd like to do at this point
is I would like to continue in the next section
where we're going to take a very deep look
at this test helper.
We're gonna rip out the entire test helper
and rewrite it from scratch.
And we're also gonna talk a lot more
about the theory behind mocha and chai
and look a little bit
at how they're working internally as well.
So I'll catch you in the next section.