fixed test for App.vue

This commit is contained in:
ogerly 2022-05-05 09:23:39 +02:00
parent 6190d686f0
commit b446b5fdd3
3 changed files with 50 additions and 1 deletions

48
frontend/src/App.spec.js Normal file
View File

@ -0,0 +1,48 @@
import { mount, RouterLinkStub } from '@vue/test-utils'
import App from './App'
import VueRouter from 'vue-router'
const localVue = global.localVue
localVue.use(VueRouter)
const router = new VueRouter()
const mockStoreCommit = jest.fn()
const stubs = {
RouterLink: RouterLinkStub,
RouterView: true,
}
describe('App', () => {
const mocks = {
$i18n: {
locale: 'en',
},
$t: jest.fn((t) => t),
$store: {
commit: mockStoreCommit,
state: {
token: null,
},
},
}
let wrapper
const Wrapper = () => {
return mount(App, { localVue, mocks, stubs, router })
}
describe('mount', () => {
beforeEach(() => {
wrapper = Wrapper()
})
it('renders the App', () => {
expect(wrapper.find('#app').exists()).toBe(true)
})
it('has a component AuthLayoutGDD', () => {
expect(wrapper.findComponent({ name: 'AuthTemplate' }).exists()).toBe(true)
})
})
})

View File

@ -9,7 +9,7 @@ import DashboardLayout from '@/layouts/DashboardLayout_gdd.vue'
import AuthLayoutGDD from '@/layouts/AuthLayout_gdd.vue'
export default {
name: 'app',
name: 'App',
components: {
DashboardLayout,
AuthLayoutGDD,

View File

@ -45,6 +45,7 @@ import { FadeTransition } from 'vue2-transitions'
import CONFIG from '@/config'
export default {
name: 'DashboardTemplate',
components: {
Navbar,
Sidebar,