> I also dispute that it’s hard to unit test the first function—-you would simply mock the api response and then you have a great test.
How many times have you seen a test pass or fail when it shouldn’t have because the mocks didn’t match the actual code? It’s a useful technique but it has drawbacks which are not easily prevented.