import React from 'react';
import ReactTestRenderer from 'react-test-renderer';
import { ConsoleMock } from 'app/testUtils/consoleMock';
import { ResponsiveWrapper } from './ResponsiveWrapper';
import Enzyme from 'enzyme/build/index';
import Adapter from 'enzyme-adapter-react-16/build/index';

describe('Responsive wrapper tests', () => {
  Enzyme.configure({ adapter: new Adapter() });

  it('renders correctly', () => {
    const consoleMock = new ConsoleMock();

    const tree = ReactTestRenderer
      .create(
        <ResponsiveWrapper>
          {() => (<div>test</div>)}
        </ResponsiveWrapper>
      )
      .toJSON();

    expect(console.error).not.toBeCalled();
    expect(tree).toMatchSnapshot();

    consoleMock.destroy();
  });

});
