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

import TutorialObstacle from '.';

describe('TutorialObstacle', () => {
  let node;
  let props;

  beforeEach(() => {
    props = {
      body: 'Mmmm iced tea.',
      heading: 'What you are seeing here is a miracle',
      closeTutorialModal: jest.fn(),
    };
    node = mount(<TutorialObstacle {...props} />);
  });

  it('should display the TutorialObstacle component', () => {
    expect(node.find('.TutorialObstacle').hasClass('TutorialObstacle')).toBe(true);
  });

  it('should call closeTutorialModal on click', () => {
    const button = node.find('button').first();
    button.simulate('click');
    expect(props.closeTutorialModal).toHaveBeenCalledTimes(1);
  });
});
