"use strict";

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

var _immutable = require("immutable");

var _chai = require("chai");

var _editing = _interopRequireDefault(require("../editing"));

var _editing2 = require("../../actions/editing");

describe('editing reducer', function () {
  it('adds a component to the list when EDIT_ON', function () {
    var initialState = (0, _immutable.Map)({
      reactComponentUniq1: true,
      reactComponentUniq2: false
    });
    var action = (0, _editing2.startEdit)('reactComponentUniq3');
    var nextState = (0, _editing.default)(initialState, action);
    (0, _chai.expect)(nextState.get('reactComponentUniq3')).to.equal(true);
  });
  it('adds changes a false to true with EDIT_ON', function () {
    var initialState = (0, _immutable.Map)({
      reactComponentUniq1: true,
      reactComponentUniq2: false
    });
    var action = (0, _editing2.startEdit)('reactComponentUniq2');
    var nextState = (0, _editing.default)(initialState, action);
    (0, _chai.expect)(nextState.get('reactComponentUniq2')).to.equal(true);
  });
  it('sets a component to false with EDIT_OFF', function () {
    var initialState = (0, _immutable.Map)({
      reactComponentUniq1: true,
      reactComponentUniq2: false
    });
    var action = (0, _editing2.endEdit)('reactComponentUniq1');
    var nextState = (0, _editing.default)(initialState, action);
    (0, _chai.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: 'something else'
    });
    var nextState = (0, _editing.default)(initialState, action);
    (0, _chai.expect)(nextState).to.equal(initialState);
  });
});