"use strict";

var _chai = require("chai");

var _quizEntries = require("../quizEntries");

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

describe('quizzes entries action creators', function () {
  it('returns a well-formed start edit action', function () {
    var setOfQuizEntries = {
      99: {
        id: '99'
      }
    };
    var addQuizEntriesAction = (0, _quizEntries.addQuizEntries)(setOfQuizEntries);
    (0, _chai.expect)(addQuizEntriesAction).to.deep.equal({
      type: _constants.ADD_QUIZ_ENTRIES,
      payload: setOfQuizEntries
    });
  });
  it('returns a well-formed action for adding single quizEntry', function () {
    var quizEntryAction = (0, _quizEntries.addQuizEntry)({
      id: '99'
    });
    (0, _chai.expect)(quizEntryAction).to.deep.eq({
      type: _constants.ADD_QUIZ_ENTRY,
      payload: {
        id: '99'
      }
    });
  });
  it('returns a well-formed action for deleting a quiz entry', function () {
    var deleteAction = (0, _quizEntries.deleteQuizEntry)('42');
    (0, _chai.expect)(deleteAction).to.deep.equal({
      type: _constants.DELETE_QUIZ_ENTRY,
      payload: {
        id: '42'
      }
    });
  });
  it('returns a well-formed action for deleting a stimulus entry', function () {
    var deleteAction = (0, _quizEntries.deleteStimulusEntry)('42', ['4', '6']);
    (0, _chai.expect)(deleteAction).to.deep.equal({
      type: _constants.DELETE_STIMULUS_ENTRY,
      payload: {
        id: '42',
        childQuizEntryIds: ['4', '6']
      }
    });
  });
  it('returns a well-formed action for moving an entry', function () {
    var moveAction = (0, _quizEntries.moveQuizEntry)('42', 3, '7');
    (0, _chai.expect)(moveAction).to.deep.equal({
      type: _constants.MOVE_QUIZ_ENTRY,
      payload: {
        id: '42',
        position: 3,
        stimulusQuizEntryId: '7'
      }
    });
  });
});