|
|
|
|
|
by aleksiy123
804 days ago
|
|
You asked for code and I gave you a fairly real world example of where mocking is useful. My suggestion is for you to provide code how you would test the same handler code and scenario using your methodology. Show me a test that checks the error handling of quota check. Pretend the quota service is experiencing an outage on the second request you make to it. |
|
Yes, okay, you got me. That isn't the HTTP service anymore. But it should have never been. The transaction processing is not an HTTP concern. In fixing that, now you can make the HTTP end of things far less obtuse:
But, this is still not a good example of input. Input doesn't matter when the network fails. Let's say we want to cover the case where the product ID being purchased doesn't exist instead: There is still plenty of room for improvement here that I will cut short as who cares for an HN comment, but man, I don't see how anyone can think that mockery monstrosity is preferable to... anything else. Where is it actually useful?