import { jsx as ___EmotionJSX } from "@emotion/core";

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

import React from 'react';
import renderer from 'react-test-renderer';
import { shallow } from 'enzyme';
import Banner from './index';
var testBanner = {
  content: ___EmotionJSX("div", null, "Your email address was updated successfully!"),
  type: 'success'
};
describe('Banner UI snapshots', function () {
  test('renders success type and text', function () {
    var component = renderer.create(___EmotionJSX(Banner, {
      content: testBanner.content,
      type: "success",
      onClick: function onClick() {}
    }));
    var tree = component.toJSON();
    expect(tree).toMatchSnapshot();
  });
  test('renders danger type and text', function () {
    var component = renderer.create(___EmotionJSX(Banner, {
      content: testBanner.content,
      type: "danger",
      onClick: function onClick() {}
    }));
    var tree = component.toJSON();
    expect(tree).toMatchSnapshot();
  });
  test('renders info type and text', function () {
    var component = renderer.create(___EmotionJSX(Banner, {
      content: testBanner.content,
      type: "info",
      onClick: function onClick() {}
    }));
    var tree = component.toJSON();
    expect(tree).toMatchSnapshot();
  });
});
test('Banner onClick is triggered on click', function () {
  jest.useFakeTimers();
  var spy = jest.fn();
  var banner = shallow(___EmotionJSX(Banner, _extends({
    onClick: spy
  }, testBanner)));
  banner.simulate('click');
  jest.runAllTimers();
  expect(spy).toHaveBeenCalled();
});