From 383184cad09d387c61e85c7e1217f4703d386b4f Mon Sep 17 00:00:00 2001 From: Derick Montague Date: Tue, 1 Dec 2020 12:30:19 -0600 Subject: Add unit testing for page section component Signed-off-by: Derick Montague Signed-off-by: Sukanya Pandey Change-Id: I1b3511f0dccaefb0732d5df3f21d10595f0fbd9a --- tests/unit/Global/PageSection.spec.js | 25 ++++++++++++++++++++++ .../Global/__snapshots__/PageSection.spec.js.snap | 12 +++++++++++ 2 files changed, 37 insertions(+) create mode 100644 tests/unit/Global/PageSection.spec.js create mode 100644 tests/unit/Global/__snapshots__/PageSection.spec.js.snap (limited to 'tests/unit/Global') diff --git a/tests/unit/Global/PageSection.spec.js b/tests/unit/Global/PageSection.spec.js new file mode 100644 index 00000000..a1b951b4 --- /dev/null +++ b/tests/unit/Global/PageSection.spec.js @@ -0,0 +1,25 @@ +import { mount, createLocalVue } from '@vue/test-utils'; +import PageSection from '@/components/Global/PageSection'; + +const localVue = createLocalVue(); + +describe('PageSection.vue', () => { + const wrapper = mount(PageSection, { + localVue, + propsData: { + sectionTitle: 'PageSection test title', + }, + mocks: { + $t: (key) => key, + }, + }); + it('should exist', () => { + expect(wrapper.exists()).toBe(true); + }); + it('should render h2 element', () => { + expect(wrapper.find('h2').exists()).toBe(true); + }); + it('should render correctly', () => { + expect(wrapper.element).toMatchSnapshot(); + }); +}); diff --git a/tests/unit/Global/__snapshots__/PageSection.spec.js.snap b/tests/unit/Global/__snapshots__/PageSection.spec.js.snap new file mode 100644 index 00000000..8e468b33 --- /dev/null +++ b/tests/unit/Global/__snapshots__/PageSection.spec.js.snap @@ -0,0 +1,12 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`PageSection.vue should render correctly 1`] = ` +
+

+ PageSection test title +

+ +
+`; -- cgit v1.2.3