I use Vue 2, vue-test-utils, jest
Plugin is vue-croppa for uploading pictures.
import Croppa from 'vue-croppa'
Vue.use(Croppa, { componentName: 'image-croppa' })
It's mounted to my component through v-model. Then i can call some methods on it.
template
<image-croppa v-model="myCroppa" ...>
script
data() {
return {
myCroppa: {},
}
},
Also i have some method that calls vue-croppa method.
handlePicture(){
const dataUri = this.myCroppa.generateDataUrl()
this.$emit('got-image', dataUri)
},
I want to test my method calls vue-croppa method.
the question is:
How can i mock this plugin, when initializing my component in a test? AND is there a need to test this behavior?