Essential Developer

View Original

S01E17: [TDD πŸ… 14] Testing the Quiz Router implementation in Swift

Watch on YouTube

In this episode, we finish test-driving the NavigationControllerRouter implementation, and we undergo a significant refactoring by replacing the old hard-coded String type questions with the new Question enum type.

We face a challenge when implementing a stub for the result as it does not conform to Hashable and its initializer is not public – we solve it by having a simple private extension only for the test module, as we don’t need this behavior in the production code.

Furthermore, we discuss other approaches for designing the Abstract Factory, such as making it conform to the Interface Segregation Principle, the I in SOLID.

Finally, we reflect on the updated architecture diagram as we foresee where the concrete factory should reside and discuss what would be the negative impact of poor design decisions.

Subscribe now to our Youtube channel and catch free new episodes every week and follow along the project's progress on GitHub.