"use strict";

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

var _callHelpers = require("../callHelpers");

describe('callHelpers', function () {
  function callHelpersTests(actionCreator, expectedStatus) {
    var expectedType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _constants.CALL_STATUS;
    var SomeType = 'SomeType';
    var action = actionCreator(SomeType);
    it('creates an action object with type CALL_STATUS', function () {
      expect(action.type).to.be.equal(expectedType);
    });
    it('has a payload with the right call and status', function () {
      expect(action.payload.call).to.be.equal(SomeType);
      expect(action.payload.status).to.be.equal(expectedStatus);
    });
  }

  describe('#startCallFor', function () {
    callHelpersTests(_callHelpers.startCallFor, 'calling');
  });
  describe('#successCallFor', function () {
    callHelpersTests(_callHelpers.successCallFor, 'success');
  });
  describe('#errorCallFor', function () {
    callHelpersTests(_callHelpers.errorCallFor, 'error');
  });
  describe('#callbacksCompleteForCall', function () {
    callHelpersTests(_callHelpers.callbacksCompleteForCall, 'complete', _constants.SET_CALLBACKS_STATUS);
  });
});