When we wrote the addLogging() preceding function, we laid by the roadside some precepts we saw in Chapter 4, Behaving Properly - Pure Functions, because we included an impure element (console.log()) right 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, certainly, 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:
describe("a logging function", function() { it("should log twice with well behaved functions", () => { let something = (a, b) => `result=${a}:${b}`; ...