Courses

Testing Vue.js Components - Learn Vue.js Component Testing - 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.

Exercise:

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.

Example:

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

Click here to view the solution.