4 ms·
Try to actually design the test that would have caught this. There is no way in this universe that one can blindly rely on tests when refactoring.
by NohatCoder 6y ago
Try to actually design the test that would have caught this. There is no way in this universe that one can blindly rely on tests when refactoring.
- alkonaut 6y agoCode that is obvious is better. That’s also difficult here (You’d for example make a function call of image_that_should_work_offline(..)” that simply returns its argument, but that’s perhaps a bit contrived). So the second best is simply a comment. // Image inlined because error may be due to dropped connection You don’t have to have tests to prevent bad refactoring. 100% test coverage isn’t realistic for most code bases (or isn’t even a net positive in many cases). self-documenting code, or tests, or comments would have saved the situation. You don’t need to design a test in this case. A one line comment that takes five seconds to write is enough.