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.
6.1 The simplicity of data-oriented test ...
Get Data-Oriented Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.