mirror of
https://github.com/IT4Change/boilerplate-frontend.git
synced 2025-12-13 07:35:53 +00:00
add tests working form dreammall
This commit is contained in:
parent
1cbf755e61
commit
7e5a7f02f6
12
src/components/ClientOnly.test.ts
Normal file
12
src/components/ClientOnly.test.ts
Normal 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()
|
||||||
|
})
|
||||||
|
})
|
||||||
48
src/pages/_error.page.test.ts
Normal file
48
src/pages/_error.page.test.ts
Normal 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')")
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
Loading…
x
Reference in New Issue
Block a user