DEV Community

Discussion on: My testing epiphany

Collapse
 
blocka profile image
Avi Block

In this particular case, I wouldn't be worried that this code is going to break, but unit testing it allows it to be tested in isolation without having actually boot up your app, and get it into the state that it needs to be in to see the results. In addition, it affords future developers with an understanding of why this function is here, and how to use it, as well as giving you a place to test various edge cases.

That said, an integration test or e2e test would be useful to make sure that you've actually called the function correctly, in other words, that you've glued everything together properly.