2020-08-29 10:19:15 +03:00
|
|
|
import { shallow, ShallowWrapper } from 'enzyme';
|
|
|
|
import createScrollToTop from '../../src/common/ScrollToTop';
|
|
|
|
|
2022-02-08 00:17:57 +03:00
|
|
|
jest.mock('react-router-dom', () => ({
|
|
|
|
...jest.requireActual('react-router-dom'),
|
|
|
|
useLocation: jest.fn().mockReturnValue({}),
|
|
|
|
}));
|
|
|
|
|
2020-08-29 10:19:15 +03:00
|
|
|
describe('<ScrollToTop />', () => {
|
|
|
|
let wrapper: ShallowWrapper;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
const ScrollToTop = createScrollToTop();
|
|
|
|
|
2022-02-08 00:17:57 +03:00
|
|
|
wrapper = shallow(<ScrollToTop>Foobar</ScrollToTop>);
|
2020-08-29 10:19:15 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => wrapper.unmount());
|
|
|
|
|
|
|
|
it('just renders children', () => expect(wrapper.text()).toEqual('Foobar'));
|
|
|
|
});
|