"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

var _immutable = require("immutable");

var taking = _interopRequireWildcard(require("../sessionItems"));

var testState = (0, _immutable.fromJS)({
  quizSessions: {
    activeQuizSessionId: 3
  },
  sessionItems: {
    '5': {
      position: 1,
      quizSessionId: 6,
      id: 5
    },
    '3': {
      position: 2,
      quizSessionId: 3,
      id: 3
    },
    '1': {
      position: 7,
      quizSessionId: 3,
      id: 1
    },
    '4': {
      position: 1,
      quizSessionId: 3,
      id: 4
    }
  }
});
describe('session item selectors', function () {
  describe('getItemByPosition', function () {
    it('defaults to null', function () {
      var result = taking.getItemByPosition(testState, 0);
      expect(result).to.eq(null);
    });
    it('gets the correct item', function () {
      var result = taking.getItemByPosition(testState, 7);
      expect(result.get('id')).to.eq(1);
    });
    it('ignores non-active session items', function () {
      var result = taking.getItemByPosition(testState, 1);
      expect(result.get('id')).to.eq(4);
    });
  });
});