Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | 23x 23x 23x 23x 3x 3x 23x 1x 1x 23x 1x 23x 23x 230x 230x 23x 1x 1x 1x 1x 1x 3x | import { createLocalVue, mount, Wrapper } from '@vue/test-utils' import Vuex from 'vuex' import VueRouter from 'vue-router' import waitForExpect from 'wait-for-expect' import Simulate from './Simulate' import * as queries from './queries' function render(TestComponent, { props = null, store = null, routes = null } = {}, configurationCb) { const localVue = createLocalVue() let vuexStore = null let router = null if (store) { localVue.use(Vuex) vuexStore = new Vuex.Store(store) } if (routes) { localVue.use(VueRouter) router = new VueRouter(routes) } if (configurationCb && typeof configurationCb === 'function') { configurationCb(localVue) } const wrapper = mount(TestComponent, { localVue, router, store: vuexStore, propsData: { ...props }, attachToDocument: true }) const wrapperHelpers = Object.entries(queries).reduce( (helpers, [key, fn]) => { helpers[key] = fn.bind(null, wrapper) return helpers }, {}, ) return { unmount: () => wrapper.destroy(), isUnmounted: () => wrapper.vm._isDestroyed, html: () => wrapper.html(), updateProps: _ => wrapper.setProps(_), updateState: _ => wrapper.setData(_), ...wrapperHelpers } } function wait(callback = () => {}, {timeout = 4500, interval = 50} = {}) { return waitForExpect(callback, timeout, interval) } export { render, wait, Simulate } |