add tests not working from dreammall

This commit is contained in:
Ulf Gebhardt 2023-12-11 17:08:43 +01:00
parent 7e5a7f02f6
commit 3137e770fe
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
2 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,20 @@
import { mount } from '@vue/test-utils'
import { describe, it, expect } from 'vitest'
import TopMenu from '#components/menu/TopMenu.vue'
import PageShell from './PageShell.vue'
describe('PageShell', () => {
const wrapper = mount(PageShell, {
slots: {
default: 'Page Content',
},
})
it('renders page content', () => {
expect(wrapper.find('.v-application').exists()).toBeTruthy()
expect(wrapper.find('.v-application').findComponent(TopMenu)).toBeTruthy()
expect(wrapper.html()).toContain('Page Content')
})
})

View File

@ -0,0 +1,34 @@
import { mount } from '@vue/test-utils'
import { describe, it, expect } from 'vitest'
import { h } from 'vue'
import { VApp } from 'vuetify/components'
import VikeBtn from '#components/VikeBtn.vue'
import LogoAvatar from './LogoAvatar.vue'
import TopMenu from './TopMenu.vue'
describe('FooterMenu', () => {
const wrapper = mount(VApp, {
slots: {
default: h(TopMenu),
},
})
it('renders three columns', () => {
expect(wrapper.find('.v-row').exists()).toBeTruthy()
expect(wrapper.findAll('.v-row > div')).toHaveLength(3)
})
it('first column contains logo', () => {
expect(wrapper.findAll('.v-row > div')[0].findComponent(LogoAvatar)).toBeTruthy()
})
it('second column contains 3 children -> AnchorLink', () => {
expect(wrapper.findAll('.v-row > div')[1].findAllComponents(VikeBtn)).toHaveLength(3)
})
it('third column is placeholdre', () => {
expect(wrapper.findAll('.v-row > div')[2].findAll('div')).toHaveLength(0)
})
})