I've been diving into JavaScript testing and have come across some confusion when it comes to mocking API calls. Most tutorials I've seen demonstrate mocking API calls for unit or integration testing, like this one: https://jestjs.io/docs/en/tutorial-async
I'm struggling to see the benefit of mocking a server response with hard-coded data in order to test that data specifically. It feels like these tests only confirm whether a mock was used instead of a real API call. But doesn't this overlook the actual behavior of the application? Am I missing something here?
Furthermore, if I wanted to test the result of a genuine API call, would that fall under functional testing? Can tools like Jest handle testing real API calls, or would Selenium or TestCafe be more suitable for this task?