taken from a great tutorial by Andre Staltz
disclaimer: easy to test pure functions, but less so the interactions