This pattern provides sample source code and key unit test components for a Node.js game API. It also includes instructions for running these unit tests from a GitHub repository by using AWS CodeBuild, as part of your continuous integration and continuous delivery (CI/CD) workflow.
Unit testing is a software development process in which different parts of an application, called units, are individually and independently tested for correct operation. Tests validate the quality of the code and confirm that it functions as expected. Other developers can also easily gain familiarity with your code base by consulting the tests. Unit tests reduce future refactoring time, help engineers get up to speed on your code base more quickly, and provide confidence in the expected behavior.
Unit testing involves testing individual functions, including AWS Lambda functions. To create unit tests, you need a testing framework and a way of validating tests (assertions). The code examples in this pattern use the Mocha testing framework and the Chai assertion library.
For more information about unit testing and examples of test components, see the Additional information section.