Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import Vue from 'vue'
import expect from 'expect'
import VueTestUtils from '@vue/test-utils'
Vue.config.productionTip = false
// IMPORTANT: DO NOT use vue-test-utils transitionStub
VueTestUtils.config.stubs.transition = false
global.expect = expect
// require all test files (files that ends with .spec.js)
const testsContext = require.context('./specs', true, /\.spec$/)
testsContext.keys().forEach(testsContext)
// require all src files except main.js for coverage.
// you can also change this to match only the subset of files that
// you want coverage for.
const srcContext = require.context('../../src', true, /^\.\/(?!index(\.js)?$)/)
srcContext.keys().forEach(srcContext)
// This Intl polyfill has some problems with number precision, so we store the original
// implementation to use it instead when that lack of accuracy is an issue
global.__Intl__ = global.Intl
global.Intl = require('intl')
HTMLCanvasElement.prototype.getContext = jest.fn()
Vue.use(VTooltip, {
defaultHtml: false,
defaultContainer: '#app'
})
Vue.use(directives)
Vue.use(filters)
Vue.config.ignoredElements = ['webview']
VueTestUtils.config.mocks.$eventBus = eventBus
VueTestUtils.config.mocks.$client = {
fetchDelegates: jest.fn()
}
VueTestUtils.config.mocks.assets_loadImage = jest.fn()
VueTestUtils.config.mocks.collections_filterChildren = jest.fn()
VueTestUtils.config.mocks.currency_format = jest.fn()
VueTestUtils.config.mocks.currency_subToUnit = jest.fn()
VueTestUtils.config.mocks.electron_openExternal = jest.fn()
VueTestUtils.config.mocks.session_network = jest.fn()
VueTestUtils.config.mocks.session_profile = jest.fn()
VueTestUtils.config.mocks.wallet_fromRoute = {}
Vue.use(VTooltip, {
defaultHtml: false,
defaultContainer: '#app'
})
Vue.use(directives)
Vue.use(filters)
Vue.config.ignoredElements = ['webview']
VueTestUtils.config.mocks.$eventBus = eventBus
VueTestUtils.config.mocks.$client = {
fetchDelegates: jest.fn()
}
VueTestUtils.config.mocks.assets_loadImage = jest.fn()
VueTestUtils.config.mocks.collections_filterChildren = jest.fn()
VueTestUtils.config.mocks.currency_format = jest.fn()
VueTestUtils.config.mocks.currency_subToUnit = jest.fn()
VueTestUtils.config.mocks.electron_openExternal = jest.fn()
VueTestUtils.config.mocks.session_network = jest.fn()
VueTestUtils.config.mocks.session_profile = jest.fn()
VueTestUtils.config.mocks.wallet_fromRoute = {}
import Vue from 'vue'
import VueCompositionApi from '@vue/composition-api'
import VueTestUtils from '@vue/test-utils'
import translations from './lang/en-US'
Vue.use(VueCompositionApi)
VueTestUtils.config.mocks.$t = msg => translations[msg]