summaryrefslogtreecommitdiff
path: root/tests/unit/Global/TableCellCount.spec.js
blob: 025d67bb2009f4af1e7b090cfb9e1f39c8bfd560 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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();
  });
});