xref: /openbmc/webui-vue/tests/unit/Global/TableCellCount.spec.js (revision 7d6b44cb263da09e575c7cb28cab88c1eb339c7b)
1*7d6b44cbSEd Tanousimport { mount } from '@vue/test-utils';
24da94959SSukanya Pandeyimport TableCellCount from '@/components/Global/TableCellCount';
34da94959SSukanya Pandey
44da94959SSukanya Pandeydescribe('TableCellCount.vue', () => {
54da94959SSukanya Pandey  const wrapper = mount(TableCellCount, {
64da94959SSukanya Pandey    propsData: {
74da94959SSukanya Pandey      filteredItemsCount: 5,
84da94959SSukanya Pandey      totalNumberOfCells: 100,
94da94959SSukanya Pandey    },
104da94959SSukanya Pandey    mocks: {
114da94959SSukanya Pandey      $t: (key) => key,
124da94959SSukanya Pandey    },
134da94959SSukanya Pandey  });
144da94959SSukanya Pandey  it('should exist', () => {
154da94959SSukanya Pandey    expect(wrapper.exists()).toBe(true);
164da94959SSukanya Pandey  });
174da94959SSukanya Pandey  it('should render filtered and totalnumber of items', () => {
184da94959SSukanya Pandey    expect(wrapper.text()).toContain('global.table.selectedItems');
194da94959SSukanya Pandey  });
204da94959SSukanya Pandey  it('should render only totalnumber of items', async () => {
214da94959SSukanya Pandey    await wrapper.setProps({ filteredItemsCount: 5, totalNumberOfCells: 5 });
224da94959SSukanya Pandey    expect(wrapper.text()).toContain('global.table.items');
234da94959SSukanya Pandey  });
244da94959SSukanya Pandey  it('should render correctly', () => {
254da94959SSukanya Pandey    expect(wrapper.element).toMatchSnapshot();
264da94959SSukanya Pandey  });
274da94959SSukanya Pandey});
28