Full-Stack Web Development with Vue.js and Node

(singke) #1
Testing an MEVN Application Chapter 9

expect(err.errors.release_year).to.exist;
done();
})
})
})
})

Here, we have prepared a movie object with release_year with an invalid value. The


expectation we have here is that, when validating the model, it should send an error.


Let's run the test, and it should pass with the following output:


Similarly, we can add tests for other models as well.


Writing tests for Vue.js components


Let's move on to write the test specs for our Vue.js components. We will start with the


simplest component, which is the Contact.vue page.


This is what we have in our Contact.vue page so far:


<template>
<v-layout>
this is contact
</v-layout>
</template>
Free download pdf