diff options
author | Sukanya Pandey <sukapan1@in.ibm.com> | 2020-12-29 13:05:01 +0300 |
---|---|---|
committer | Yoshie Muranaka <yoshiemuranaka@gmail.com> | 2021-01-09 00:50:25 +0300 |
commit | 4da9495925d601bb4edfb8b007d5b54792b7491b (patch) | |
tree | 1ed932712ea8f2b9c872ecc25e549c8fbc79bb90 /tests/unit/Global | |
parent | 383571357baa54fd5c46de096349b7b0213a203e (diff) | |
download | webui-vue-4da9495925d601bb4edfb8b007d5b54792b7491b.tar.xz |
Add unit test cases for table cell count component
Signed-off-by: Sukanya Pandey <sukapan1@in.ibm.com>
Change-Id: Id948347cd38a9e58d21aaf4180afe8ab5c2f2ed7
Diffstat (limited to 'tests/unit/Global')
-rw-r--r-- | tests/unit/Global/TableCellCount.spec.js | 30 | ||||
-rw-r--r-- | tests/unit/Global/__snapshots__/TableCellCount.spec.js.snap | 11 |
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/unit/Global/TableCellCount.spec.js b/tests/unit/Global/TableCellCount.spec.js new file mode 100644 index 00000000..025d67bb --- /dev/null +++ b/tests/unit/Global/TableCellCount.spec.js @@ -0,0 +1,30 @@ +import { mount, createLocalVue } from '@vue/test-utils'; +import TableCellCount from '@/components/Global/TableCellCount'; + +const localVue = createLocalVue(); + +describe('TableCellCount.vue', () => { + const wrapper = mount(TableCellCount, { + localVue, + propsData: { + filteredItemsCount: 5, + totalNumberOfCells: 100, + }, + mocks: { + $t: (key) => key, + }, + }); + it('should exist', () => { + expect(wrapper.exists()).toBe(true); + }); + it('should render filtered and totalnumber of items', () => { + expect(wrapper.text()).toContain('global.table.selectedItems'); + }); + it('should render only totalnumber of items', async () => { + await wrapper.setProps({ filteredItemsCount: 5, totalNumberOfCells: 5 }); + expect(wrapper.text()).toContain('global.table.items'); + }); + it('should render correctly', () => { + expect(wrapper.element).toMatchSnapshot(); + }); +}); diff --git a/tests/unit/Global/__snapshots__/TableCellCount.spec.js.snap b/tests/unit/Global/__snapshots__/TableCellCount.spec.js.snap new file mode 100644 index 00000000..2906cb82 --- /dev/null +++ b/tests/unit/Global/__snapshots__/TableCellCount.spec.js.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`TableCellCount.vue should render correctly 1`] = ` +<div + class="mt-2" +> + <p> + global.table.items + </p> +</div> +`; |