DEV Community

Discussion on: Yet another reason to prefer unit tests 😇

Collapse
 
jdforsythe profile image
Jeremy Forsythe

I find much more frustration in e2e testing. I'd you write pure functions and stay away from DI, unit testing is relatively easy.

Collapse
 
thecodingalpaca profile image
Carlos Trapet

True, except when you have to write unit tests for an app where everything is extremely coupled and has 0 tests, which is exactly where I'm at right now :(

Collapse
 
jimpriest profile image
Jim Priest

Agree. This is much more difficult with a spaghetti/legacy project :)

The other dilemma is while the developer may want to refactor something - that time/cost has to be factored in somewhere and often it's a difficult to sell to the client: 'if it ain't broke don't fix it...'