diff options
author | Derick Montague <derick.montague@ibm.com> | 2020-12-01 21:30:19 +0300 |
---|---|---|
committer | Yoshie Muranaka <yoshiemuranaka@gmail.com> | 2020-12-02 03:02:58 +0300 |
commit | 383184cad09d387c61e85c7e1217f4703d386b4f (patch) | |
tree | 76f0c258402f9974751820cdc8027b7b5160c3c2 /tests | |
parent | 1dedbdf26f92451a3fb0e737fbbc4852c01d905c (diff) | |
download | webui-vue-383184cad09d387c61e85c7e1217f4703d386b4f.tar.xz |
Add unit testing for page section component
Signed-off-by: Derick Montague <derick.montague@ibm.com>
Signed-off-by: Sukanya Pandey <sukapan1@in.ibm.com>
Change-Id: I1b3511f0dccaefb0732d5df3f21d10595f0fbd9a
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/Global/PageSection.spec.js | 25 | ||||
-rw-r--r-- | tests/unit/Global/__snapshots__/PageSection.spec.js.snap | 12 |
2 files changed, 37 insertions, 0 deletions
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`] = ` +<div + class="page-section" +> + <h2> + PageSection test title + </h2> + +</div> +`; |