How to use the @vue/test-utils.createLocalVue function in @vue/test-utils

To help you get started, we’ve selected a few @vue/test-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dobromir-hristov / vuelidate-error-extractor / test / unit / templates / multi-error-extractor / baseMultiErrorExtractor.spec.js View on Github external
import baseMultiErrorExtractor from '@/templates/multi-error-extractor/baseMultiErrorExtractor'
import FormWrapper from '@/templates/form-wrapper.js'
import { required, minLength, email, maxLength } from 'vuelidate/lib/validators'
import { createLocalVue, mount } from '@vue/test-utils'
import Vuelidate from 'vuelidate'
import VueI18n from 'vue-i18n'
import _merge from 'lodash.merge'
import { i18nMessages } from '../../testData'

const localVue = createLocalVue()
localVue.use(VueI18n)
localVue.use(Vuelidate)

/**
 * Creates the testable component wrapper
 * @param opts
 * @param {ComponentOptions} [opts.componentOpts] - Override component options
 * @param {ThisTypedMountOptions} [opts.mountOpts] - Override mount options
 * @return {Wrapper}
 */
function createWrapper (opts = {}) {
  const { componentOpts = {}, mountOpts = {} } = opts
  const i18n = new VueI18n({
    locale: 'en', // set locale
    messages: i18nMessages // set locale messages
  })
github luniehq / lunie / tests / unit / specs / components / common / TmSessionImportSuccess.spec.js View on Github external
import Vuex from "vuex"
import Vuelidate from "vuelidate"
import { shallowMount, createLocalVue } from "@vue/test-utils"
import TmSessionImportSuccess from "common/TmSessionImportSuccess"
// import TmBtn from "common/TmBtn"
jest.mock(`scripts/google-analytics.js`, () => () => {})
const localVue = createLocalVue()
localVue.use(Vuex)
localVue.use(Vuelidate)
localVue.directive(`tooltip`, () => {})
localVue.directive(`focus`, () => {})

describe(`TmSessionImportSuccess`, () => {
  let wrapper, $store, getters

  beforeEach(() => {
    getters = {}
    $store = {
      state: {
        recover: {
          name: ``,
          seed: ``,
          password: ``,
github techlab23 / task-management-app / tests / unit / components / Boards / TaskBoardEdit.spec.js View on Github external
import TaskBoardEdit from "@/components/Boards/TaskBoardEdit.vue"
import { mount, createLocalVue, RouterLinkStub } from "@vue/test-utils"
import flushPromises from "flush-promises"
import Vuex from "vuex"
import VeeValidate from "vee-validate"
const localVue = createLocalVue()
localVue.use(Vuex)
localVue.use(VeeValidate)

import { Bus } from "@/utils/bus"
Bus.$on = jest.fn()

describe("TaskBoardEdit.vue", () => {
  let $store
  let wrapper

  beforeEach(() => {
    $store = {
      dispatch: jest.fn(),
      getters: {
        activeBoard: { id: "222" }
      }
github ArkEcosystem / desktop-wallet / __tests__ / unit / components / Wallet / WalletSidebar.spec.js View on Github external
import { createLocalVue, shallowMount } from '@vue/test-utils'
import installI18n from '../../__utils__/i18n'
import WalletMixin from '@/mixins/wallet'
import WalletSidebar from '@/components/Wallet/WalletSidebar'

const localVue = createLocalVue()
const i18n = installI18n(localVue)

const contacts = [
]
const wallets = [
]

const mount = (propsData = {}, mocks = {}) => {
  mocks = {
    $route: {},
    $store: {
      getters: {
        'delegate/byAddress': jest.fn(),
        'wallet/contactsByProfileId': () => contacts,
        'wallet/byProfileId': () => wallets,
        'session/walletSidebarFilters': { hideEmpty: false, hideLedger: false },
github l-hammer / v-track / tests / unit / track-click-param.spec.js View on Github external
/*
 * @Author: 宋慧武
 * @Date: 2019-04-09 18:23:04
 * @Last Modified by: 宋慧武
 * @Last Modified time: 2019-04-13 21:56:46
 */
import Vue from "vue";
import VTrack from "@/";
import { mount, createLocalVue } from "@vue/test-utils";

const localVue = createLocalVue();
const mockTrackAction = jest.fn();
const trackEvents = {
  18015: mockTrackAction
};
const TrackClickHasParam = Vue.extend({
  template: `
    <div></div>
  `,
  data() {
    return {
      item: {
        id: 1
      },
      id: 0
    };
  },
github luniehq / lunie / tests / unit / specs / components / network / PageBlock.spec.js View on Github external
import { shallowMount, createLocalVue } from "@vue/test-utils"
import PageBlock from "network/PageBlock"
import { bankTxs } from "../../store/json/txs"

const localVue = createLocalVue()
localVue.directive(`tooltip`, () => {})

describe(`PageBlock`, () => {
  let wrapper

  const getters = {
    connected: true,
    lastHeader: {
      height: `1000`
    },
    block: {
      block: {
        header: {
          height: `100`,
          num_txs: bankTxs.length,
          proposer_address: `ABCDEFG123456HIJKLMNOP`,
github morkro / happy-plants / src / app / intro / screens / HowTo.spec.js View on Github external
import { shallowMount, createLocalVue } from '@vue/test-utils'
import HowTo from '@/app/intro/screens/HowTo'
import Box from '@/components/Box'
import store from '@/store'
import router from '@/router'

const localVue = createLocalVue()

describe('app/intro/HowTo.vue', () =&gt; {
  const options = {
    localVue,
    store,
    router,
    stubs: {
      'better-dialog': '<div>',
      'svgicon': '<div>',
      'v-box': Box,
      'feather-arrow-left': '<svg></svg>'
    }
  }

  it('is a Vue component', () =&gt; {
    const wrapper = shallowMount(HowTo, options)</div></div>
github bootstrap-vue / bootstrap-vue / src / directives / popover / popover.spec.js View on Github external
it('should work', async () =&gt; {
    jest.useFakeTimers()
    const localVue = new CreateLocalVue()

    const App = localVue.extend({
      directives: {
        bPopover: VBPopover
      },
      template: `<button title="<b>foobar</b>">button</button>`
    })

    const wrapper = mount(App, {
      localVue: localVue,
      attachToDocument: true
    })

    expect(wrapper.isVueInstance()).toBe(true)
    expect(wrapper.is('button')).toBe(true)
    const $button = wrapper.find('button')
github Enalean / tuleap / plugins / document / scripts / document / helpers / local-vue.js View on Github external
* but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Tuleap. If not, see .
 *
 */

import { createLocalVue } from "@vue/test-utils";
import Vuex from "vuex";
import VueDOMPurifyHTML from "vue-dompurify-html";
import GettextPlugin from "vue-gettext";
import VueRouter from "vue-router";

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

localVue.use(VueDOMPurifyHTML);
localVue.use(GettextPlugin, {
    translations: {},
    silent: true,
});

export default localVue;