We have seen how pure functions are conceptually better than impure ones, but we cannot set out on a crusade to vanquish all impurity from our code. First, no one can deny that side effects can be useful, or at least unavoidable: you will need to interact with the DOM or call a web service, and there are no ways to do it in a pure way. So, rather on bemoaning the fact that you have to allow for impurity, try to structure your code so you can isolate the impure functions, and let the rest of your code be the best possible.
With this in mind, you'll have to be able to write unit tests for all kinds of functions, pure or impure. Writing unit tests for functions is different, as to its difficulty and complexity, when you deal with pure or impure functions. While coding tests for the former is usually quite simple and follows a basic pattern, the latter...