"use strict";

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

var _presenter = _interopRequireDefault(require("../presenter"));

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

describe('RceImageImportModal', function () {
  var setUploadStatusStub = sinon.stub();
  var props = {
    setUploadStatus: setUploadStatusStub
  };
  var testbed = createTestbed(withContext(_presenter.default), props);
  afterEach(function () {
    setUploadStatusStub.resetHistory();
  });
  it('should render', function () {
    testbed.render();
    var component = testbed.findChildByType(_presenter.default);
    expect(component).to.not.be.undefined();
  });
  describe('#successWrapper', function () {
    it('calls the successAction with the correct args', function () {
      var subject = testbed.render();
      var successActionStub = sinon.stub();
      var fakeUrl = 'myfakeUrl.com';
      var fileType = 'image/png';
      subject.refs.composedComponent.successWrapper(successActionStub, fileType)(fakeUrl);
      expect(successActionStub).to.be.calledWith(fakeUrl, fileType);
    });
    it('sets the upload status to success', function () {
      testbed.render();
      testbed.subject.refs.composedComponent.successWrapper(function () {})();
      expect(setUploadStatusStub).to.be.calledWith(_constants.FILE_UPLOAD_SUCCESS);
    });
  });
  describe('a11y tests', function () {
    it('should meet a11y standards', function (done) {
      testbed.render();
      testbed.checkA11yStandards(done);
    });
  });
});