"use strict";

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

var _immutable = require("immutable");

var _chai = require("chai");

var _stimuli = _interopRequireDefault(require("../stimuli"));

var _stimuli2 = require("../../actions/stimuli");

var _Stimulus = _interopRequireDefault(require("../../records/Stimulus"));

describe('stimuli reducer', function () {
  describe('addStimulus', function () {
    it('should add new stimuli with ADD_STIMULI action', function () {
      var initialState = (0, _immutable.fromJS)({});
      var action = (0, _stimuli2.addStimuli)([{
        id: '1',
        title: 'hello'
      }]);
      var nextState = (0, _stimuli.default)(initialState, action);
      var nextStimulus = nextState.get('1').get('title');
      (0, _chai.expect)(nextStimulus).to.equal('hello');
    });
    it('should replace stimuli with ADD_STIMULI action', function () {
      var initialState = (0, _immutable.fromJS)({
        1: new _Stimulus.default({
          id: '1',
          title: 'hello'
        })
      });
      var action = (0, _stimuli2.addStimuli)([{
        id: '1',
        stimulusBody: 'hi'
      }, {
        id: '2',
        stimulusBody: 'world'
      }]);
      var nextState = (0, _stimuli.default)(initialState, action);
      var nextStimulusOne = nextState.get('1').get('stimulusBody');
      (0, _chai.expect)(nextStimulusOne).to.equal('hi');
      var nextStimulusTwo = nextState.get('2').get('stimulusBody');
      (0, _chai.expect)(nextStimulusTwo).to.equal('world');
    });
  });
});