Add unit test cases for table cell count component
Signed-off-by: Sukanya Pandey <sukapan1@in.ibm.com>
Change-Id: Id948347cd38a9e58d21aaf4180afe8ab5c2f2ed7
diff --git a/tests/unit/Global/TableCellCount.spec.js b/tests/unit/Global/TableCellCount.spec.js
new file mode 100644
index 0000000..025d67b
--- /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();
+ });
+});