Sukanya Pandey | 4da9495 | 2020-12-29 15:35:01 +0530 | [diff] [blame] | 1 | import { mount, createLocalVue } from '@vue/test-utils'; |
| 2 | import TableCellCount from '@/components/Global/TableCellCount'; |
| 3 | |
| 4 | const localVue = createLocalVue(); |
| 5 | |
| 6 | describe('TableCellCount.vue', () => { |
| 7 | const wrapper = mount(TableCellCount, { |
| 8 | localVue, |
| 9 | propsData: { |
| 10 | filteredItemsCount: 5, |
| 11 | totalNumberOfCells: 100, |
| 12 | }, |
| 13 | mocks: { |
| 14 | $t: (key) => key, |
| 15 | }, |
| 16 | }); |
| 17 | it('should exist', () => { |
| 18 | expect(wrapper.exists()).toBe(true); |
| 19 | }); |
| 20 | it('should render filtered and totalnumber of items', () => { |
| 21 | expect(wrapper.text()).toContain('global.table.selectedItems'); |
| 22 | }); |
| 23 | it('should render only totalnumber of items', async () => { |
| 24 | await wrapper.setProps({ filteredItemsCount: 5, totalNumberOfCells: 5 }); |
| 25 | expect(wrapper.text()).toContain('global.table.items'); |
| 26 | }); |
| 27 | it('should render correctly', () => { |
| 28 | expect(wrapper.element).toMatchSnapshot(); |
| 29 | }); |
| 30 | }); |