"use strict";

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

var _immutable = require("immutable");

var _chai = require("chai");

var _sessionItemResults = _interopRequireDefault(require("../sessionItemResults"));

var _sessionItemResults2 = require("../../actions/sessionItemResults");

describe('sessionItemResults reducer', function () {
  describe('add sessionItemResults', function () {
    it('should add sessionItemResults with ADD_SESSION_ITEM_RESULTS action', function () {
      var initialState = (0, _immutable.Map)({});
      var sessionItemResults = [{
        position: '1',
        id: '1_1',
        score: 3.5,
        attempt: 1,
        item_id: '1',
        feedback: 'nice shot!'
      }, {
        position: '2',
        id: '2_2',
        score: 2.5,
        attempt: 1,
        item_id: '2',
        feedback: 'what a save!'
      }];
      var action = (0, _sessionItemResults2.addSessionItemResults)(sessionItemResults);
      var nextState = (0, _sessionItemResults.default)(initialState, action);
      var firstScore = nextState.getIn(['1_1', 'score']);
      (0, _chai.expect)(firstScore).to.equal(3.5);
      var secondFeedback = nextState.getIn(['2_2', 'feedback']);
      (0, _chai.expect)(secondFeedback).to.equal('what a save!');
    });
  });
});