Summary

In this chapter, we've looked at testing in Node and hapi, and how testing as well as code coverage are paramount in the hapi ecosystem. We've seen justification for their needs in application development, and how they can make us a more productive developer.

We've also introduced the test runner and code assertion libraries lab and code in the ecosystem and justified their use. You've learnt how to use them for writing simple tests, and how to use the tools provided in lab and hapi to test hapi applications.

You've also learned of some of the extra features baked into lab such as code coverage and linting. We looked at testing the code coverage of an application and getting it to 100%, and explained how the hapi ecosystem applies the hapi style guide to all the modules using the linting integration inlab.

As always, all code samples seen here as well as some extra material can be found online in the repository available at https://github.com/johnbrett/Getting-Started-with-hapi.js.

However, I highly recommend reading through the code associated with this chapter, especially, as I've also updated the user store example from the previous chapter to include tests with 100% code coverage.

Now that you have learned how to secure your code, and ensure that it does what you expect through testing, we will look at securing our applications through authentication and authorization in the next chapter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.82.21