diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/Global/PageTitle.spec.js | 33 | ||||
-rw-r--r-- | tests/unit/Global/__snapshots__/PageTitle.spec.js.snap | 15 |
2 files changed, 48 insertions, 0 deletions
diff --git a/tests/unit/Global/PageTitle.spec.js b/tests/unit/Global/PageTitle.spec.js new file mode 100644 index 00000000..5cb2691b --- /dev/null +++ b/tests/unit/Global/PageTitle.spec.js @@ -0,0 +1,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(); + }); +}); diff --git a/tests/unit/Global/__snapshots__/PageTitle.spec.js.snap b/tests/unit/Global/__snapshots__/PageTitle.spec.js.snap new file mode 100644 index 00000000..7c1bca74 --- /dev/null +++ b/tests/unit/Global/__snapshots__/PageTitle.spec.js.snap @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`PageTitle.vue should render correctly 1`] = ` +<div + class="page-title" +> + <h1> + Page Title + </h1> + + <p> + A page title test description + </p> +</div> +`; |