import React from 'react';
import { shallow } from 'enzyme';
import MissedTarget from './missed-target';

describe('<MissedTarget />', () => {
  const headline = 'Test headline';
  const subheadline = 'Test subheadline';
  const summary = 'Test summary';

  it('should render the correct default className', () => {
    const component = shallow(<MissedTarget headline={headline} />);
    expect(component.find('div').props().className).toEqual('ds-missed-target');
  });

  it('should render the headline', () => {
    const component = shallow(<MissedTarget headline={headline} />);

    expect(component.find('.ds-missed-target__headline').text()).toContain(
      headline,
    );
  });

  it('should render the subheadline', () => {
    const component = shallow(
      <MissedTarget headline={headline} subheadline={subheadline} />,
    );

    expect(component.find('.ds-missed-target__subheadline').text()).toContain(
      subheadline,
    );
  });

  it('should render the summary', () => {
    const component = shallow(
      <MissedTarget headline={headline} summary={summary} />,
    );

    expect(component.find('.ds-missed-target__summary').text()).toContain(
      summary,
    );
  });
});
