When we wrote the addLogging() function, we looked at some precepts we saw in Chapter 4, Behaving Properly – Pure Functions, because we included an impure element (console.log()) in our code. With this, not only did we lose flexibility (would you be able to select an alternate way of logging?) but we also complicated our testing. We could manage to test it by spying on the console.log() method, but that isn't very clean: we depend on knowing the internals of the function we want to test, instead of doing a purely black-box test. Take a look at the following example for a clearer understanding of this:
describe("a logging function", function() { it("should log twice with well behaved functions", () => { let something ...