3 ms·
The 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 on
by yCombLinks 3y ago
The 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.