Navigating to the details
We will implement the navigation within the app using the AppCoordinator
class. Follow these steps to implement navigation to the details of to-do items:
- Add the following test method to
AppCoordinatorTests
:// AppCoordinatorTests.swift func test_selectToDoItem_pushesDetails() throws { let dummyViewController = UIViewController() let item = ToDoItem(title: "dummy title") sut.selectToDoItem(dummyViewController, item: item) let detail = try XCTUnwrap( navigationControllerMock.lastPushedViewController as? ToDoItemDetailsViewController) XCTAssertEqual(detail.toDoItem, item) }
In this test, we execute the delegate
method and assert that an instance of ToDoItemDetailsViewController
is pushed to the navigation stack, and that its toDoItem
is the item we used in the delegate
method call.
Run the tests to confirm that this new test...