Configuring and testing a Fastify application
In the previous recipe, I mentioned that the application could be considered complete. However, as an application truly achieves completeness only when it has a comprehensive test suite, in this recipe, our focus shifts to testing our endpoints to assert their functionality and correctness. This testing ensures that as we make changes to the code in the future, we can reliably verify that we have not introduced any new bugs or regressions.
We will use the new Node.js test runner in this recipe, providing a sneak peek into Chapter 8, where we will delve deeper into this subject and do so in a more focused manner. For now, we will cover the basics to get you started with testing. So, let’s start this new goal!
Getting ready
We will begin this recipe by reading the application’s configuration, followed by writing application tests.
Up until now, we’ve hardcoded certain elements in our code, including the following...