So over the last lectures we wrote some tests,
now are these all the tests we can ride for navigation items?
They might be, we might also want to test the class we get here or something like that.
But in general this looks like a good test coverage for me, writing good tests is complicated,
it's easy to write 100 tests for a given component and test all kind of things while it's missing the one important
thing you should have tested and on the other way around, you might only need one test to really verify
if a component behaves the way you want it to behave.
Now I can only encourage you to just practice and write a lot of tests for different components, test
for different things no matter if they makes sense to be tested or not, learn how to test how to think
in test environments and learn how to use the different functions provided by enzyme and jest.
It really is all about practicing and testing takes experience, the best way to start with testing is
to always have a look at your component or your function or whatever you are testing and see what are
the crucial things that change depending on some external influences like here, the isAuthenticated part
which changes what gets rendered.
And then this should be what you write the test for,
so that whenever you change something in the navigation items component and you accidentally mess up like
here, if I remove the exclamation mark before this check, now we got failed tests if I save this component
because this also re-executes tests if you change your normal code
and now I got failed tests
and you see that here indeed, this should render three navigation items if authenticated fails, because now
we render a different amount, that by the way is referring to the third test where I didn't update my
naming,
this should of course showed an exact logout button. But still, the case holds true,
it fails here
and it also fails the previous test.
So always then have a look at your test errors and identify crucial parts just like that,
what can I easily break and what would then totally break my application behavior?
And then you write tests for exactly that.