From b446b5fdd337cefeb29cd9cb8e76bcc9f6ad0ae7 Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 5 May 2022 09:23:39 +0200 Subject: [PATCH] fixed test for App.vue --- frontend/src/App.spec.js | 48 ++++++++++++++++++++ frontend/src/App.vue | 2 +- frontend/src/layouts/DashboardLayout_gdd.vue | 1 + 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 frontend/src/App.spec.js diff --git a/frontend/src/App.spec.js b/frontend/src/App.spec.js new file mode 100644 index 000000000..bd9bf1e87 --- /dev/null +++ b/frontend/src/App.spec.js @@ -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) + }) + }) +}) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 072fa83c9..725d9df71 100755 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -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, diff --git a/frontend/src/layouts/DashboardLayout_gdd.vue b/frontend/src/layouts/DashboardLayout_gdd.vue index f65329470..c9a25eff0 100755 --- a/frontend/src/layouts/DashboardLayout_gdd.vue +++ b/frontend/src/layouts/DashboardLayout_gdd.vue @@ -45,6 +45,7 @@ import { FadeTransition } from 'vue2-transitions' import CONFIG from '@/config' export default { + name: 'DashboardTemplate', components: { Navbar, Sidebar,