import { shallow, ShallowWrapper } from 'enzyme'; import { Mock } from 'ts-mockery'; import ShlinkVersionsContainer from '../../src/common/ShlinkVersionsContainer'; import { NonReachableServer, NotFoundServer, ReachableServer, SelectedServer } from '../../src/servers/data'; describe('', () => { let wrapper: ShallowWrapper; const createWrapper = (selectedServer: SelectedServer) => { wrapper = shallow(); return wrapper; }; afterEach(() => wrapper?.unmount()); it.each([ [ null, 'text-center' ], [ Mock.of({ serverNotFound: true }), 'text-center' ], [ Mock.of({ serverNotReachable: true }), 'text-center' ], [ Mock.of({ version: '1.0.0' }), 'text-center shlink-versions-container--with-server' ], ])('renders proper col classes based on type of selected server', (selectedServer, expectedClasses) => { const wrapper = createWrapper(selectedServer); expect(wrapper.find('div').prop('className')).toEqual(`${expectedClasses}`); }); });