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

import { Heading } from './Heading';

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

  beforeEach(() => {
    wrapper = shallow(
      <Heading content="Heading test content" />
    );
  });

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

  it('renders Header', () => {
    expect(wrapper.find('Header')).toExist();
    expect(wrapper.find('Header').children())
      .toHaveText('Heading test content');
  });

  it('renders header with h3 as prop if no level exist', () => {
    expect(wrapper.find('Header')).toHaveProp('as', 'h3');
  });

  it('renders header with html header tag that matches level', () => {
    wrapper.setProps({ level: 4 });
    expect(wrapper.find('Header')).toHaveProp('as', 'h4');
  });
});
