Transcript
00:00 What we have here is an extremely permissive request handler. It matches all HTTP requests our app makes. Now, this can be handy in certain situations, like when you want to observe the outgoing traffic, for example. But when mocking API is in test, it's rare that you want to handle a bunch of requests in the same way. In this exercise,
00:19 your task will be to write a more targeted request handler. You will remove this HTTP all handler and instead create a new handler precisely for this request that we're making in the getAuthToken function. You will match this request by its method and also the request URL. And your next assignment will be to respond
00:37 to that intercepted request with a mock response. Now, this function can handle a bunch of different response scenarios. But for this exercise, your task will be to reproduce a successful response, which is a JSON response with a token property in its body. And once you do that, head to the test case for this function
00:55 and complete it by creating an assertion to make sure that the getAuthToken function returns the correct token. Give it your best shot and see you in the solution to this exercise.