3 ms·
> The rest is implementation details that should not be exposed to a test. But it's always implementation details all the way down! If `prepare` is not worth
by mrkeen 3y ago
> The rest is implementation details that should not be exposed to a test.
But it's always implementation details all the way down!
If `prepare` is not worth testing, why would `createPizza` be worth testing? `createPizza` is someone else's implementation detail.
- yCombLinks 3y agoThe goal of this unit of code is to create a pizza from an order. There are no observable side affects. To verify the correctness of this unit of code, the only requirement is to map all inputs to outputs. Any assertions other than that mapping are not requirements to test correctness.
- mrkeen 3y agoYes, and I can create an even larger 'unit' of code around it, declare that it has 'no observable side effects', and claim that `createPizza` is just an implementation detail of that, and therefore needs no testing.
- yCombLinks 3y agoMaybe? We don't know about the other code. Most code I work with would be sticking this output in a db or email or something, so any larger piece can't be isolated, so is no longer a single unit. It's about isolation from side affects, not how much code you can stick behind a single method call.