I'm curious about the necessity of testing for each unit of production-ready code. For instance, there's a GitHub project that I came across, and it seems like it only has tests for semantic versioning. To me, that feels somewhat trivial compared to the various functions within the game. Am I missing something here? When exactly are tests regarded as essential for production-ready code?
6 Answers
Definitely! Sometimes, changes that seem minor can actually break things unexpectedly. For example, Tomcat switched its default timing from milliseconds to nanoseconds, and it caused issues in Spring logging. It’s a reminder that even small changes can have big impacts.
I refuse to approve any pull requests unless they come with full unit test coverage for all business logic and, ideally, integration tests too. In a professional environment, shipping without at least that is unacceptable. But I understand that in legacy systems, testing can be a challenge.
Having tests that cover every possible code branch helps ensure that edge cases won’t slip through the cracks. Plus, unit tests can significantly simplify the process of identifying where a bug might be, instead of digging deep later on during high-level testing.
Not every project requires unit tests for everything, so it's a "no" for mandatory tests. However, I usually aim for 100% line coverage in my own projects.
You don't need to test every single line, but it's crucial to have enough tests to ensure that new code doesn't break existing features.
Over time, you'll develop a gut feeling for how much testing is sufficient. You might write too many tests at first and waste time, or you might skimp on them and then end up spending days tracking down tricky bugs.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically