"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

var _react = _interopRequireDefault(require("react"));

var _enzyme = require("enzyme");

var _ = _interopRequireDefault(require("."));

var _components = require("../../../../ui/components");

var getClientRectSpy = jest.fn(function () {
  return {
    width: 100
  };
});
Range.prototype.getBoundingClientRect = getClientRectSpy;
Range.prototype.getClientRects = getClientRectSpy;
describe('TutorialHero', function () {
  var node;
  var props;
  beforeEach(function () {
    props = {
      openTutorial: jest.fn(),
      hero: {
        backgroundColor: 'fff',
        description: 'test tutorial desc',
        title: 'test tutorial title',
        emoji: '🦉',
        _id: '123',
        steps: [{
          title: 'Step one',
          body: 'body uno',
          lineNumbers: ['']
        }],
        snippet: {
          codeOptions: [{
            code: 'const res = true;',
            language: 'javascript',
            name: 'Node'
          }]
        }
      }
    };
    node = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_["default"], props));
  });
  it('should display the TutorialTile component', function () {
    expect(node.find('.TutorialHero').hasClass('TutorialHero')).toBe(true);
  });
  it('should handle button click event', function () {
    node.find(_components.Button).first().simulate('click');
    expect(props.openTutorial).toHaveBeenCalledWith('View', props.hero);
  });
});