import React from 'react';
import { shallow } from 'enzyme';
import Footer from './footer';

describe('<Footer />', () => {
  const footer = shallow(<Footer />);

  it('should have the correct number of social links', () => {
    const socialLinkCount = 8;
    expect(footer.find('ShareLink')).toHaveLength(socialLinkCount);
  });

  it('should have the correct number of footer link lists', () => {
    const footerListCount = 4;
    expect(footer.find('FooterList')).toHaveLength(footerListCount);
  });

  it('should display the mission statement section', () => {
    expect(
      footer
        .find('p')
        .first()
        .text(),
    ).toContain('Published since September 1843');
  });

  it('should display the copyright section', () => {
    expect(
      footer
        .find('p')
        .last()
        .text(),
    ).toContain('Copyright © The Economist Newspaper');
  });

  it('should display the cookie notice section', () => {
    expect(footer.find('FooterCookieNotice')).toHaveLength(1);
  });
});
