2019-01-14 01:03:31 +03:00
|
|
|
import React from 'react';
|
|
|
|
import { shallow } from 'enzyme';
|
|
|
|
import createScrollToTop from '../../src/common/ScrollToTop';
|
|
|
|
|
|
|
|
describe('<ScrollToTop />', () => {
|
|
|
|
let wrapper;
|
|
|
|
const window = {
|
2019-04-19 11:29:49 +03:00
|
|
|
scrollTo: jest.fn(),
|
2019-01-14 01:03:31 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
const ScrollToTop = createScrollToTop(window);
|
|
|
|
|
|
|
|
wrapper = shallow(<ScrollToTop locaction={{ href: 'foo' }}>Foobar</ScrollToTop>);
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
wrapper.unmount();
|
2019-04-19 11:29:49 +03:00
|
|
|
window.scrollTo.mockReset();
|
2019-01-14 01:03:31 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
it('just renders children', () => expect(wrapper.text()).toEqual('Foobar'));
|
|
|
|
});
|