DEV Community

Discussion on: 5 ways to refactor if/else statements in JS functions

Collapse
 
sylwiavargas profile image
Sylwia Vargas

Ah! True. I edited that part and didn't edit the examples. Argh I should write unit tests for my blogs 😩 Thank you!

Collapse
 
bjornet profile image
Björn Christensson

That is the way to go! Smart, if all code samples came from actual unit tests eg. Mocha you would also practice the mentality of "placing tests in the first room".

Thread Thread
 
sylwiavargas profile image
Sylwia Vargas

Yeah I might try it in some future blogs. I've always been a fan of TDD but never made space to properly go through all the phases and the process because I felt there was "not enough time". I'm slowly changing this mindset not only because I feel like TDD is really awesome but also because of how the "not enough time" mindset impacts me and my ability to code at times.