add tests working form dreammall

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

View File

@ -0,0 +1,12 @@
import { mount } from '@vue/test-utils'
import { describe, it, expect } from 'vitest'
import ClientOnly from './ClientOnly.vue'
describe('ClientOnly', () => {
const wrapper = mount(ClientOnly)
it('renders content if mounted', async () => {
expect(wrapper.isVisible()).toBeTruthy()
})
})

View File

@ -0,0 +1,48 @@
import { mount } from '@vue/test-utils'
import { describe, it, expect } from 'vitest'
import ErrorPage from './_error.page.vue'
describe('ErrorPage', () => {
let wrapper
const Wrapper = () => {
return mount(ErrorPage)
}
beforeEach(() => {
wrapper = Wrapper()
})
describe('no is404 property set', () => {
it('renders error 500', () => {
expect(wrapper.find('h1').text()).toEqual("$t('error.500.h1')")
expect(wrapper.find('p').text()).toEqual("$t('error.500.text')")
})
})
describe('is404 property is false', () => {
beforeEach(async () => {
await wrapper.setProps({
is404: false,
})
})
it('renders error 500', () => {
expect(wrapper.find('h1').text()).toEqual("$t('error.500.h1')")
expect(wrapper.find('p').text()).toEqual("$t('error.500.text')")
})
})
describe('is404 property is true', () => {
beforeEach(async () => {
await wrapper.setProps({
is404: true,
})
})
it('renders error 400', () => {
expect(wrapper.find('h1').text()).toEqual("$t('error.404.h1')")
expect(wrapper.find('p').text()).toEqual("$t('error.404.text')")
})
})
})