Checking items
In a to-do app, the user needs to be able to mark to-do items as done. This is an important feature of a to-do app because part of the reason people use such apps is the satisfying feeling when marking a to-do as done.
So, our app also needs this feature. As the process of building this app is driven by tests, we start with a new test for this feature. But before we can add the test for this feature, we need to think about how we can assert in the test that the feature works. This means we need a way to get all the to-do items that are already done. The easiest way to differentiate the done to-do items from the ones that are still to be done is with a property in the to-do item itself. This way, we can filter all the to-do items according to the value of that property.
With this plan, we can start writing the test:
- Add the following method to
ToDoItemStoreTests.swift
:// ToDoItemStoreTests.swift func test_check_shouldPublishChangeInDoneItems() throws ...