summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSukanya Pandey <sukapan1@in.ibm.com>2020-12-29 13:05:01 +0300
committerYoshie Muranaka <yoshiemuranaka@gmail.com>2021-01-09 00:50:25 +0300
commit4da9495925d601bb4edfb8b007d5b54792b7491b (patch)
tree1ed932712ea8f2b9c872ecc25e549c8fbc79bb90 /tests
parent383571357baa54fd5c46de096349b7b0213a203e (diff)
downloadwebui-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')
-rw-r--r--tests/unit/Global/TableCellCount.spec.js30
-rw-r--r--tests/unit/Global/__snapshots__/TableCellCount.spec.js.snap11
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>
+`;