1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
import { mount, createLocalVue } from '@vue/test-utils';
import PageTitle from '@/components/Global/PageTitle';
const localVue = createLocalVue();
describe('PageTitle.vue', () => {
const wrapper = mount(PageTitle, {
localVue,
propsData: {
description: 'A page title test description',
},
mocks: {
$t: (key) => key,
$route: {
meta: {
title: 'Page Title',
},
},
},
});
it('should exist', () => {
expect(wrapper.exists()).toBe(true);
});
it('should render h1 element', () => {
expect(wrapper.find('h1').exists()).toBe(true);
});
it('should render p element', () => {
expect(wrapper.find('p').exists()).toBe(true);
});
it('should render correctly', () => {
expect(wrapper.element).toMatchSnapshot();
});
});
|