import { shallow } from 'enzyme';
import React from 'react';

import { Image } from './Image';

describe('Image block', () => {
  let wrapper;

  beforeEach(() => {
    wrapper = shallow(
      <Image id={ 1 } />
    );
  });

  it('renders', () => {
    expect(wrapper).toExist();
  });

  it('renders a MediaImage', () => {
    expect(wrapper.find('MediaImage')).toExist();
  });

  it('passes content to the MediaImage component', () => {
    expect(wrapper.find('MediaImage')).toHaveProp('id', 1);
  });

  it('renders nothing if there is no id', () => {
    wrapper.setProps({ id: undefined });
    expect(wrapper).toBeEmptyRender();
  });
});
