December 2018
Intermediate to advanced
414 pages
10h 19m
English
As Stub verifies the indirect input, a Test Spy permits us to verify the indirect output, exposing a way that indicates whether the functions in the Spy were called during the test. Let's consider a variation of the TaskManager that we implemented in the Dummy example, Dummy test double: when we don't need to test the collaborator, that manages the tasks in a remote server. We want to verify that the tasks are refreshed, fetching them from the server when TaskManager is constructed. The code for the manager is the following:
protocol TaskManagerService { func fetchTask(completion: ([Task]) -> Void) func sync(tasks: [Task])}class TaskManager { private let service: TaskManagerService private var tasks ...Read now
Unlock full access