"use strict";

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

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

var _constants = require("@instructure/quiz-common/lib/constants");

describe('BankEntry Record', function () {
  describe('#getEntry', function () {
    var returnsEntryOfType = function returnsEntryOfType(constructorType, entryId) {
      it('returns correct entry', function () {
        var bankEntry = new _BankEntry.default({
          entryType: constructorType,
          entry: {
            get: function get() {}
          }
        });
        expect(bankEntry.getEntry().constructor.name).to.equal(constructorType);
      });
      it('returns correct temporary entry', function () {
        var tempBankEntry = new _BankEntry.default({
          entryType: constructorType,
          entry: entryId
        });
        expect(tempBankEntry.getEntry().constructor.name).to.equal(constructorType);
      });
    };

    context('item', function () {
      returnsEntryOfType('Item', _constants.TEMPORARY_ITEM_ID);
    });
    context('stimulus', function () {
      returnsEntryOfType('Stimulus', _constants.TEMPORARY_STIMULUS_ID);
    });
  });
  describe('#isStimulus', function () {
    it('returns true when stimulus entry type', function () {
      var bankEntry = new _BankEntry.default({
        entryType: 'Stimulus'
      });
      expect(bankEntry.isStimulus).to.be.true();
    });
    it('returns false when item entry type', function () {
      var bankEntry = new _BankEntry.default({
        entryType: 'Item'
      });
      expect(bankEntry.isStimulus).to.be.false();
    });
  });
});