Vue.js unit:test : Is there any way to mock a Vee-Validate validator plugin? Vue.js unit:test : Is there any way to mock a Vee-Validate validator plugin? vue.js vue.js

Vue.js unit:test : Is there any way to mock a Vee-Validate validator plugin?


Have you tried to use stubs of your functions using sinon ? They mentioned that on vue test utils with setMethods.

It could look like:

import { mount } from '@vue/test-utils'import sinon from 'sinon'import ContactForm from './ContactForm.vue'const wrapper = mount(ContactForm)const submit = wrapper.find('button')const validateStub = sinon.stub()allInputs.setMethods({ validateAll: validateStub })submit.trigger('click')expect(validateStub.called).toBe(true)

So you would be able to know if the validateAll method is called when you submit the form for example. Or you could try asking on github/VeeValidate