Hacker News new | ask | show | jobs
by terrortrain 2120 days ago
For js->ts, this is right on the money.

When I started unit tests way back when, half the tests were just checking what happens if you give it strange arguments.TS now does that job for me.

Another thing that has cut down on the number of tests is switching to pure functions for most things. And trying to isolate side effects as much as possible, so you really don't need to write to many tests around it. If the function only has one or two lines, typically types are enough to catch potential issues.

1 comments

It's one of the things that really frustrates me with the ASP.net team. They're obsessed with unit testing, have made really stupid decisions that means tons of stuff now gets injected instead of just passed, all in the name of unit testing.

But C# is a typed language and generally doesn't need reams of unit tests, so all it does is make the code unnecessarily complicated.

My big bugbear was when they idiotically made the config injected, of all the things that should be super simple to use, and definitely not injected, it's config. It only changes between environments.