DEV Community

Discussion on: Unit testing is simple

Collapse
 
rubberduck profile image
Christopher McClellan

What happens when you have different results for the same input?

You implement it as a proper state machine and test each state independently. The vending machine Kata is a great example of just that. Man, that one drove me up the wall. I'd much prefer to just have functions that always return the same output given the same input.

github.com/rubberduck203/VendingMa...