"use strict";

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

var _immutable = require("immutable");

var _index = _interopRequireDefault(require("../index"));

var _Bank = _interopRequireDefault(require("../../../../../../../common/records/Bank"));

var _QuizEntry = _interopRequireDefault(require("../../../../../../../common/records/QuizEntry"));

var _BankEntry = _interopRequireDefault(require("../../../../../../../common/records/BankEntry"));

describe('QuizEntryBankShow', function () {
  var quizEntryBankProps = {
    entry: new _Bank.default(),
    quizEntry: new _QuizEntry.default()
  };
  var testbed = createTestbed(_index.default, quizEntryBankProps);
  var shallowtestbed = testbed.renderShallowly();
  describe('QuizEntryBankShow', function () {
    it('renders the quiz entry bank', function () {
      var text = shallowtestbed.find('Text').render().text();
      expect(text).to.include('All questions pulled from bank:');
    });
    it('renders the quiz entry bank with number of questions pulled and points possible', function () {
      var bankTestbed = testbed.renderShallowly({
        quizEntry: new _QuizEntry.default({
          pointsPossible: 5,
          properties: (0, _immutable.Map)({
            sampleNum: 2
          })
        })
      });
      var text = bankTestbed.find('Text').last().render().text();
      expect(text).to.include('2 questions pulled randomly from bank:  5 points per question');
    });
    it('renders sampleNum errors', function () {
      var bankTestbed = testbed.renderShallowly({
        quizEntry: new _QuizEntry.default({
          pointsPossible: 5,
          properties: (0, _immutable.Map)({
            sampleNum: 2
          })
        }),
        entry: new _Bank.default({
          entryCount: 1
        })
      });
      var alertText = bankTestbed.find('Alert').last().render().text();
      expect(alertText).to.include('Max number of bank questions exceeded!');
    });
    it('renders deleted errors', function () {
      var bankTestbed = testbed.renderShallowly({
        quizEntry: new _QuizEntry.default(),
        entry: new _BankEntry.default({
          archived: true
        })
      });
      var alertText = bankTestbed.find('Alert').last().render().text();
      expect(alertText).to.include('Item bank no longer exists!');
    });
  });
});