Learn Vue JS course Learn Javascript and Vue JS Learn VueJS course Learn VueJS Tutorial

Testing Vue.js Components

Get access to the most comprehensive Vue.js video library in the world. Over 300 video lessons including the newest Vue 3 features.

Learn How To Test Vue.js Methods

In this lesson, we’re learning how to test a Vue component’s methods.

Vue.js methods are just everyday functions, which means that we do not need to mount our component to test the functionality. Let's see how we can do so!

The component we are testing has two types of methods. One is quite simple and returns a string while the other one is asynchronous. We will use mocks to test our component in this lesson.

The component we test in this lesson can be demoed on codesandbox.