"use strict";

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

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

var _enzyme = require("enzyme");

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

var _mock = _interopRequireDefault(require("./mock.json"));

describe('APILog', function () {
  var node = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_["default"], {
    link: "#testing",
    log: _mock["default"][2]
  }));
  var anotherNode = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_["default"], {
    link: "#testing",
    log: _mock["default"][0]
  }));
  var shallowNode = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_["default"], {
    log: _mock["default"][1]
  }));
  node.find('.APILog-copy').first().simulate('click');
  it('displays an API log', function () {
    expect(shallowNode.hasClass('APILog')).toBe(true);
  });
  it('displays request details', function () {
    expect(shallowNode.find('APILogRequest')).toHaveLength(1);
  });
  it('displays response details', function () {
    expect(shallowNode.find('APILogResponse')).toHaveLength(1);
  });
  it('displays tabbed request and response details', function () {
    var pre = node.find('.Tabs-listItem_active').text();
    node.find('.Tabs-listItem').at(2).simulate('click');
    var post = node.find('.Tabs-listItem_active').text();
    expect(pre).toBe('Request');
    expect(post).toBe('Response');
  });
  it('does not render 0 in headers table', function () {
    var text = anotherNode.find('APILogRequest').childAt(3).childAt(0).text();
    expect(text).not.toBe('0');
  });
  node.find('.APILog-copy').first().simulate('click');
});