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 Computed Properties and Watchers

In this lesson, we’ll learn how to test one of our favorite features of Vue.js, computed properties, and watchers.

There is also a testing exercise at the end of the lesson.


Create a test that given a string ending with f, as a temp prop.

Expect that the fahrenheit computed property must be a number equal to the prop without the f suffix.

The celsius computed property should convert the Fahrenheit to Celsius.


Given temp: ’50f’ , vm.farenheight should be 50 and vm.celcius should be 10.

Click here to view the solution.