S01E21: [TDD π 18] Testing Presenters in Swift pt.2
/In this episode, we finish test-driving the ResultsPresenter
and QuestionPresenter
implementations.
To provide a good user experience, we test-drive a very important factor for the result presentation: order! Yes, order matters for the players, so it is essential to test it as well.
Furthermore, we quickly test-drive a QuestionPresenter
implementation as we discuss our preference for using if
vs guard
statements.
We decided to build the Presenters
as structs rather than classes, since thereβs no mutation involved in the mapping process, but we also discuss how the Presenter layer could be just a collection of pure functions. Itβs up to you, as an engineer, to decide the best option for your project.
Finally, we use the newly created QuestionPresenter
to assist the QuestionViewController
configuration tests in the concrete view controller factory implementation. Red-green-refactor!
Subscribe now to our Youtube channel and catch free new episodes every week and follow along the project's progress on GitHub.