vue-typescript-admin-template icon indicating copy to clipboard operation
vue-typescript-admin-template copied to clipboard

Writing unit tests for Login component

Open smurugu opened this issue 5 years ago • 1 comments

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

smurugu avatar Oct 13 '20 13:10 smurugu

默认的色彩好难受,朦朦胧胧的感觉

TANZAME avatar Nov 20 '20 06:11 TANZAME