"use strict";

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

var _immutable = require("immutable");

var _errorsShowing = _interopRequireDefault(require("../errorsShowing"));

var _errorsShowing2 = require("../../actions/errorsShowing");

describe('errorsShowing reducer', function () {
  it('clears the errors showing', function () {
    var initialState = (0, _immutable.Map)({
      reactComponentUniq1: true,
      reactComponentUniq2: false
    });
    var action = (0, _errorsShowing2.clearErrorsShowing)();
    var nextState = (0, _errorsShowing.default)(initialState, action);
    expect(nextState.equals((0, _immutable.Map)())).to.equal(true);
  });
  it('adds a component to the list when SHOW_ERROR', function () {
    var initialState = (0, _immutable.Map)({
      reactComponentUniq1: true,
      reactComponentUniq2: false
    });
    var action = (0, _errorsShowing2.showError)('reactComponentUniq3');
    var nextState = (0, _errorsShowing.default)(initialState, action);
    expect(nextState.get('reactComponentUniq3')).to.equal(true);
  });
  it('adds changes a false to true with SHOW_ERROR', function () {
    var initialState = (0, _immutable.Map)({
      reactComponentUniq1: true,
      reactComponentUniq2: false
    });
    var action = (0, _errorsShowing2.showError)('reactComponentUniq2');
    var nextState = (0, _errorsShowing.default)(initialState, action);
    expect(nextState.get('reactComponentUniq2')).to.equal(true);
  });
  it('sets a component to false with HIDE_ERROR', function () {
    var initialState = (0, _immutable.Map)({
      reactComponentUniq1: true,
      reactComponentUniq2: false
    });
    var action = (0, _errorsShowing2.hideError)('reactComponentUniq1');
    var nextState = (0, _errorsShowing.default)(initialState, action);
    expect(nextState.get('reactComponentUniq1')).to.equal(false);
  });
  it('returns the original state with bad action', function () {
    var initialState = (0, _immutable.Map)({
      reactComponentUniq1: true
    });
    var action = (0, _immutable.Map)({
      type: 'SOME_OTHER_TYPE'
    });
    var nextState = (0, _errorsShowing.default)(initialState, action);
    expect(nextState).to.equal(initialState);
  });
});