diff options
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> +`; |