5
FuckTS
5y

My brain hurts from trying to figure out this unit testing crap. Is it just me or is it really a struggle to test your front-end code? I'm using jest and enzyme to test our React app but complicated parts of code with multiple state changes or calling props is making my life a living hell. I mean I usually just debug by console logging everything and it works lol...but my fucking boss has forced me into writing this unit testing crap. FML.

Comments
  • 4
    Unit tests are important and definitely worthwhile, but the thing missing from most explanations is that you really have to design your code to be unit tested from the start.

    Unit testing a bunch of code not split up into units and not written with unit testing in mind can certainly be done, but as you're finding out, it often feels like you're trying to crowbar things in everywhere to not really test much useful.

    If feasible, I'd suggest going back and refactoring the bits you need to to ensure you can fit your tests in nicely.
  • 0
    @AlmondSauce yeah our project was not written with unit testing in mind, this means I might have to refactor maybe half the code...idk what to do at this point.
  • 2
    hmm... you could do a name change from @FuckTS to @FuckUT 🤷‍♂️
  • 1
    Rxmarbles makes it a breeze for me.
  • 2
    @heyheni
    I might even agree with it. Because, you know, fuck UT. University of Texas, University of Tennessee , unreal tournament, Utah, use taxes, uma Thurman. Fuck the lot of em.
  • 0
    @SortOfTested and ugly titties.
  • 1
Add Comment