The problem
I'd developed some functionality which meant changes to pricing needed approval. I wrote the code with a suite a unit tests and sent it for QA. The tester found a very simple bug - when rejecting a price change, the price was still changed! Oops ๐
The triumph
The tests I'd written for the original functionality gave me confidence that my fix wouldn't accidentally break the functionality for approving price changes. On this occasion I didn't even do any manual regression testing because I had confidence in my test suite. This increased confidence and time saved on testing is the payback for the time invested when developing the original functionality.
The takeaway
When developing functionality, it is of course difficult to know whether or not bugs will be found in it. Part of the value which unit tests add is increasing your confidence that any future bug fixes which you (or another developer) may need to write will not break existing functionality which you (at the time of writing) understand well.