6 Unit tests
Programming at a coffee shop
This chapter covers
- Generation of the minimal data input for a test case
- Comparison of the output of a function with the expected output
- Guidance about the quality and the quantity of the test cases
In a data-oriented system, our code deals mainly with data manipulation: most of our functions receive data and return data. As a consequence, itâs quite easy to write unit tests to check whether our code behaves as expected. A unit test is made of test cases that generate data input and compare the data output of the function with the expected data output. In this chapter, we write unit tests for the queries and mutations that we wrote in the previous chapters.