December 2018
Intermediate to advanced
414 pages
10h 19m
English
When someone is talking about Mock, they probably mean test double—as you have seen, the differences between the types of test double are really subtle. However, test mock is a well-defined test double. The goal here is to verify the indirect input and generate the indirect output in a precise way.
In the test, we set the expectations, which are the function invocations with the exact parameters, and at the end of the test, we verify the actual versus the expected invocation in the mock. For this example, we still use TaskManager with a store, modifying it to returning the number of tasks after adding one.
Since we need to check the exact parameter passed in the invocation, we add an id property to ...
Read now
Unlock full access