Testing something for purely functional programming in JS