Writing unit tests for Login component
I'm submitting a
Unable to write unit test case with the given example on the repo
Current behavior
Latest version from master branch. mount expects some structure on the component causing type not defined error
Expected behavior
Documentation or sample code would be helpful
Minimal reproduction of the problem with instructions
import { mount, createLocalVue, shallowMount } from '@vue/test-utils' import Login from '@/views/login/index.vue' import VueRouter from 'vue-router' import ElementUI from 'element-ui' //import i18n from '@/lang'
const localVue = createLocalVue() localVue.use(VueRouter) localVue.use(ElementUI, { i18n: (key:string, value:string) => i18n.t(key, value) })
const routes = [ { path: '/', name: 'home', children: [{ path: 'dashboard', name: 'dashboard' }] }] const router = new VueRouter({ routes }) describe('Login.vue', () => { it('toggle click', () => { //const wrapper = shallowMount(Login,{localvue}) const wrapper = mount(Login, {localVue,router}) }) })
What is the motivation / use case for changing the behavior
Will be able to contribute or develop more test cases for the project
Environment
默认的色彩好难受,朦朦胧胧的感觉