Sorry, should have said “aren’t JUST to make sure your code works when you write it”
I was specifically responding to the commenter I replied to, who said they didn’t need tests because their code just worked the first time after he wrote it.
You don't. But you only need to test it once (manually), then commit it.
You write automated tests so that you can keep running the tests later such that the behaviour is maintained through refactor and non-breaking changes.
Yeah I‘m not sure that‘s how software engineering should work.
Tests should prove a desired behaviour. Sometimes it‘s not possible to fully run code until late in some staging, just because there are a lot of dependencies and conplexity. That‘s what tests are for (on various lebels of abstraction).