Test Doubles Are A Scam
summary
Claim: test doubles are a scam because they encourage mixing logic and effects and hide poor architecture. Demonstrations use Elm-style commands and a Swift Request struct that returns a value describing network effects, a pure Handler for a Slack-style ++ bot, and a Twitter activity view model that emits Request value describing effect so tests verify values not network calls. Result: unit tests become simple value-in/value-out and snapshot tests replace mocks, enabling reuse and a single imperative shell that, according to reported experience, reduces brittle tests and follows functional core, imperative shell.
AI-written summary · about
chapters (12)
- 0:00Intro
- 1:00Bad tests exist
- 1:44The best code is easy to test
- 2:28Unit tests vs. integration tests
- 4:54Test doubles verify effects
- 5:41Programs combine logic and effects
- 14:51Functional core, imperative shell
- 15:56Impure functional programming
- 16:44Value types for side effects
- 22:00The system executes values
- 23:54Functional UIkit?
- 27:57class Root Controller: UIViewController
