Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Another benefit of small well understood components is that they are easier to write tests for. Do these npm modules have good test coverage? Did the leftpad module have a unit test that would have caught the issue?


No, leftpad has four test cases and they are all obvious, given the leftpad API.

Would I write tests for my own leftpad implementation if I were not farming it out to a dependency? Its possible. More likely I would want to understand the intent behind using leftpad in my application or library, and have test for "formatTicket" or whatever it is that I'm actually doing. But for all the talk about tiny modules that cover surprisingly tricky edge cases, this is not one of them.


which issue? I thought we were talking about the random removal of left-pad and a couple hundred others.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: