How to use the @vue/test-utils.config.stubs 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 Human-Connection / Human-Connection / webapp / components / LoginForm / LoginForm.spec.js View on Github external
import LoginForm from './LoginForm.vue'
import Styleguide from '@human-connection/styleguide'
import Vuex from 'vuex'
import { config, mount, createLocalVue } from '@vue/test-utils'

const localVue = createLocalVue()
localVue.use(Vuex)
localVue.use(Styleguide)

config.stubs['nuxt-link'] = '<span></span>'
config.stubs['locale-switch'] = '<span></span>'
config.stubs['client-only'] = '<span></span>'

describe('LoginForm', () =&gt; {
  let mocks
  let propsData
  let storeMocks

  beforeEach(() =&gt; {
    propsData = {}
  })

  describe('mount', () =&gt; {
    const Wrapper = () =&gt; {
      storeMocks = {
        getters: {
          'auth/pending': () =&gt; false,
github Human-Connection / Human-Connection / webapp / components / Modal / ReportModal.spec.js View on Github external
import { config, shallowMount, mount } from '@vue/test-utils'
import ReportModal from './ReportModal.vue'

const localVue = global.localVue

config.stubs['sweetalert-icon'] = '<span></span>'

describe('ReportModal.vue', () =&gt; {
  let wrapper
  let propsData
  let mocks

  beforeEach(() =&gt; {
    propsData = {
      type: 'contribution',
      id: 'c43',
    }
    mocks = {
      $t: jest.fn(a =&gt; a),
      $filters: {
        truncate: a =&gt; a,
      },
github Human-Connection / Human-Connection / webapp / components / Modal / ConfirmModal.spec.js View on Github external
import { config, shallowMount, mount } from '@vue/test-utils'

import ConfirmModal from './ConfirmModal.vue'
import { postMenuModalsData } from '~/components/utils/PostHelpers'

const localVue = global.localVue

config.stubs['sweetalert-icon'] = '<span></span>'

describe('ConfirmModal.vue', () =&gt; {
  let Wrapper
  let wrapper
  let propsData
  let mocks
  const postName = 'It is a post'
  const confirmCallback = jest.fn()
  const cancelCallback = jest.fn()

  beforeEach(() =&gt; {
    propsData = {
      type: 'contribution',
      id: 'p23',
      name: postName,
      modalData: postMenuModalsData(postName, confirmCallback, cancelCallback).delete,
github Human-Connection / Human-Connection / webapp / components / Notification / Notification.spec.js View on Github external
import { config, mount, RouterLinkStub } from '@vue/test-utils'
import Notification from './Notification.vue'

import Vuex from 'vuex'

const localVue = global.localVue

config.stubs['client-only'] = '<span></span>'

describe('Notification', () =&gt; {
  let stubs
  let getters
  let mocks
  let propsData
  let wrapper
  beforeEach(() =&gt; {
    propsData = {}
    mocks = {
      $t: key =&gt; key,
    }
    stubs = {
      NuxtLink: RouterLinkStub,
    }
    getters = {
github Human-Connection / Human-Connection / webapp / components / features / ReportRow / ReportRow.spec.js View on Github external
import { config, mount, RouterLinkStub } from '@vue/test-utils'
import Vuex from 'vuex'
import ReportRow from './ReportRow.vue'
import BaseIcon from '~/components/_new/generic/BaseIcon/BaseIcon'
import { reports } from '~/components/features/ReportList/ReportList.story.js'

const localVue = global.localVue

config.stubs['client-only'] = '<span></span>'

describe('ReportRow', () =&gt; {
  let propsData, mocks, stubs, getters, wrapper

  beforeEach(() =&gt; {
    propsData = {}
    mocks = {
      $t: jest.fn(string =&gt; string),
    }
    stubs = {
      NuxtLink: RouterLinkStub,
    }
    getters = {
      'auth/user': () =&gt; {
        return { slug: 'awesome-user' }
      },
github Human-Connection / Human-Connection / webapp / components / NotificationsTable / NotificationsTable.spec.js View on Github external
import { config, mount, RouterLinkStub } from '@vue/test-utils'

import Vuex from 'vuex'
import NotificationsTable from './NotificationsTable'

import { notifications } from '~/components/utils/Notifications'
const localVue = global.localVue

localVue.filter('truncate', string =&gt; string)

config.stubs['client-only'] = '<span></span>'

describe('NotificationsTable.vue', () =&gt; {
  let wrapper, mocks, propsData, stubs
  const postNotification = notifications[0]
  const commentNotification = notifications[1]

  beforeEach(() =&gt; {
    mocks = {
      $t: jest.fn(string =&gt; string),
    }
    stubs = {
      NuxtLink: RouterLinkStub,
    }
    propsData = {}
  })
github Human-Connection / Human-Connection / webapp / components / Comment / Comment.spec.js View on Github external
import { config, shallowMount } from '@vue/test-utils'
import Comment from './Comment.vue'
import Vuex from 'vuex'

const localVue = global.localVue

config.stubs['client-only'] = '<span></span>'

describe('Comment.vue', () =&gt; {
  let propsData
  let mocks
  let getters
  let wrapper
  let Wrapper

  beforeEach(() =&gt; {
    propsData = {}
    mocks = {
      $t: jest.fn(),
      $toast: {
        success: jest.fn(),
        error: jest.fn(),
      },
github Human-Connection / Human-Connection / webapp / components / PostCard / PostCard.spec.js View on Github external
import { config, shallowMount, mount, RouterLinkStub } from '@vue/test-utils'

import Vuex from 'vuex'

import PostCard from './PostCard.vue'

const localVue = global.localVue

config.stubs['client-only'] = '<span></span>'
config.stubs['v-popover'] = '<span></span>'

describe('PostCard', () =&gt; {
  let store
  let stubs
  let mocks
  let propsData
  let getters
  let Wrapper
  let wrapper

  beforeEach(() =&gt; {
    propsData = {
      post: {
        id: 'p23',
        name: 'It is a post',
github Human-Connection / Human-Connection / webapp / components / ContentMenu / ContentMenu.spec.js View on Github external
import { config, mount, createLocalVue } from '@vue/test-utils'
import Vuex from 'vuex'
import VTooltip from 'v-tooltip'
import Styleguide from '@human-connection/styleguide'
import ContentMenu from './ContentMenu.vue'

const localVue = createLocalVue()

localVue.use(Styleguide)
localVue.use(VTooltip)
localVue.use(Vuex)

config.stubs['router-link'] = '<span></span>'

let getters, mutations, mocks, menuToggle, openModalSpy

describe('ContentMenu.vue', () =&gt; {
  beforeEach(() =&gt; {
    mocks = {
      $t: jest.fn(str =&gt; str),
      $i18n: {
        locale: () =&gt; 'en',
      },
      $router: {
        push: jest.fn(),
      },
    }
  })
github Human-Connection / Human-Connection / webapp / pages / index.spec.js View on Github external
import { config, shallowMount, mount } from '@vue/test-utils'
import PostIndex from './index.vue'
import Vuex from 'vuex'
import FilterMenu from '~/components/FilterMenu/FilterMenu'

const localVue = global.localVue

config.stubs['client-only'] = '<span></span>'
config.stubs['router-link'] = '<span></span>'
config.stubs['nuxt-link'] = '<span></span>'
config.stubs['infinite-loading'] = '<span></span>'

describe('PostIndex', () =&gt; {
  let wrapper
  let Wrapper
  let store
  let mocks
  let mutations

  beforeEach(() =&gt; {
    mutations = {
      'posts/SELECT_ORDER': jest.fn(),
    }
    store = new Vuex.Store({
      getters: {
        'posts/filter': () =&gt; ({}),