Skip to Content
Vue.js 2 Cookbook
book

Vue.js 2 Cookbook

by Andrea Passaglia
April 2017
Intermediate to advanced
454 pages
12h 51m
English
Packt Publishing
Content preview from Vue.js 2 Cookbook

How it works...

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.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Vue.js 2

Learning Vue.js 2

Olga Filipova
Pro Vue.js 2

Pro Vue.js 2

Adam Freeman

Publisher Resources

ISBN: 9781786468093Supplemental Content