[Vuejs]-VueJS Mocha Test case failing when using VeeValidate

0👍

This is how I arranged my code and it works just fine:

import Vuex from 'vuex';
import { createLocalVue, shallowMount } from '@vue/test-utils';
import MyComponent from '@/views/MyComponent.vue';
import VeeValidate from 'vee-validate';

const localVue = createLocalVue();
localVue.use(VeeValidate)
localVue.use(Vuex)

describe('MyComponent.vue', () => {
  let actions
  let store

  beforeEach(() => {
    store = new Vuex.Store({
      actions,
      store
    })
  })


  it('sets the correct page header', () => {
    const wrapper = shallowMount(DataOverride, {
        sync: false,
        localVue,
        store: store
    });

    const pageHeader = wrapper.find('h4').text();

    expect(pageHeader).toBe('Override Fields');
  })
})

I hope this helps you.

Leave a comment