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

Testing Vue.js Components

Get access to this course, 15 others, and future Vue.js courses!

Start Learning

Already got an account? Log in

Learn How to Test Vue.js Lifecycle Methods

Lifecycle methods are a very power Vue.js feature, that we use all time time.

In this lesson, we’re learning how to test the vue.js lifecycle methods or lifecycle hooks as they’re also called.

The lesson contains examples of how to test the mounted, beforeDestroy and destroyed hook. It should give you the insights to test any lifecycle method you desire.

We will use a spy to test the beforeDestroy hook. Follow the link to learn more about spies in testing.

You can find the demo on codesandbox