April 2017
Intermediate to advanced
454 pages
12h 51m
English
In our case, we used the sandbox to stub a method of one of our dependencies. This way, the get method of axios never gets fired and we receive an object that is similar to what the backend will give us.
Stubbing the API responses will get you isolated from the backend and its quirks. If something goes wrong, you won't mind and, moreover, you can run your test without relying on the backend running correctly.
There are many libraries and techniques to stub API calls in general, not only related to HTTP. Hopefully, this recipe has given you a head start.