"use strict";

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

var _immutable = require("immutable");

var _chai = require("chai");

var _sidebar = _interopRequireDefault(require("../sidebar"));

var _sidebar2 = require("../../actions/sidebar");

describe('sidebar reducer', function () {
  it('handles TOGGLE_SIDEBAR with isOpen false', function () {
    var initialState = (0, _immutable.Map)({
      isOpen: false
    });
    var action = (0, _sidebar2.toggleSidebar)();
    var nextState = (0, _sidebar.default)(initialState, action);
    (0, _chai.expect)(nextState.get('isOpen')).to.equal(true);
  });
  it('handles TOGGLE_SIDEBAR with isOpen true', function () {
    var initialState = (0, _immutable.Map)({
      isOpen: true
    });
    var action = (0, _sidebar2.toggleSidebar)();
    var nextState = (0, _sidebar.default)(initialState, action);
    (0, _chai.expect)(nextState.get('isOpen')).to.equal(false);
  });
  it('returns the original state with bad action', function () {
    var initialState = (0, _immutable.Map)({
      isOpen: false
    });
    var action = (0, _immutable.Map)({
      type: 'something else'
    });
    var nextState = (0, _sidebar.default)(initialState, action);
    (0, _chai.expect)(nextState).to.equal(initialState);
  });
  it('handles SET_SIDEBAR_STIMULUS_IS_SHOWING', function () {
    var initialState = (0, _immutable.fromJS)({
      3: true
    });
    var action = (0, _sidebar2.setSidebarStimulusIsShowing)('3', false);
    var nextState = (0, _sidebar.default)(initialState, action);
    (0, _chai.expect)(nextState.get('3')).to.equal(false);
  });
});