You cannot "Unit" test functions that performs IO, because by definition a unit test is about testing an isolated piece of code that give the same result for the same input, i.e. pure.
In my programs I separate the non-IO parts for the IO parts, so that I can test the non-IO parts.
The IO parts are mainly the GUI parts of my apps, which I test manually.

Now it should be possible to trick the IO monad by supplying always the same user input to your function, but I don't know how to do that.t performs, because by definition a unit test is about testing an isolated piece of code that give the same result for the same input, i.e. pure.