Add unit test cases for table toolbar component
Signed-off-by: Sukanya Pandey <sukapan1@in.ibm.com>
Change-Id: I2e93244fcd8bbde7c9398cf0db56d5125614aa69
diff --git a/tests/unit/Global/TableToolbar.spec.js b/tests/unit/Global/TableToolbar.spec.js
new file mode 100644
index 0000000..fc2beac
--- /dev/null
+++ b/tests/unit/Global/TableToolbar.spec.js
@@ -0,0 +1,27 @@
+import { mount, createLocalVue } from '@vue/test-utils';
+import TableToolbar from '@/components/Global/TableToolbar';
+import BootstrapVue from 'bootstrap-vue';
+
+const localVue = createLocalVue();
+localVue.use(BootstrapVue);
+describe('TableToolbar.vue', () => {
+ const wrapper = mount(TableToolbar, {
+ localVue,
+ propsData: {
+ selectedItemsCount: 0,
+ },
+ mocks: {
+ $t: (key) => key,
+ },
+ });
+ it('should exist', () => {
+ expect(wrapper.exists()).toBe(true);
+ });
+ it('should render class toolbar-container when selectedItemsCount is greater than 0', async () => {
+ await wrapper.setProps({ selectedItemsCount: 12 });
+ expect(wrapper.find('.toolbar-container').exists()).toBe(true);
+ });
+ it('should render correctly', () => {
+ expect(wrapper.element).toMatchSnapshot();
+ });
+});