Sukanya Pandey | d348c44 | 2021-01-05 11:28:36 +0530 | [diff] [blame] | 1 | import { mount, createLocalVue } from '@vue/test-utils'; |
| 2 | import TableToolbar from '@/components/Global/TableToolbar'; |
| 3 | import BootstrapVue from 'bootstrap-vue'; |
| 4 | |
| 5 | const localVue = createLocalVue(); |
| 6 | localVue.use(BootstrapVue); |
| 7 | describe('TableToolbar.vue', () => { |
| 8 | const wrapper = mount(TableToolbar, { |
| 9 | localVue, |
| 10 | propsData: { |
| 11 | selectedItemsCount: 0, |
| 12 | }, |
| 13 | mocks: { |
| 14 | $t: (key) => key, |
| 15 | }, |
| 16 | }); |
| 17 | it('should exist', () => { |
| 18 | expect(wrapper.exists()).toBe(true); |
| 19 | }); |
| 20 | it('should render class toolbar-container when selectedItemsCount is greater than 0', async () => { |
| 21 | await wrapper.setProps({ selectedItemsCount: 12 }); |
| 22 | expect(wrapper.find('.toolbar-container').exists()).toBe(true); |
| 23 | }); |
| 24 | it('should render correctly', () => { |
| 25 | expect(wrapper.element).toMatchSnapshot(); |
| 26 | }); |
| 27 | }); |