"use strict";

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

var _immutable = require("immutable");

var _QuizAnalysis = _interopRequireDefault(require("../../../../common/records/QuizAnalysis"));

var _QuizAnalysisOverview = _interopRequireDefault(require("../QuizAnalysisOverview"));

var _CentileDistribution = _interopRequireDefault(require("../../charts/CentileDistribution"));

describe('QuizAnalysisOverview', function () {
  var quizId = '1';
  var getQuizAnalysisStub = sinon.stub();
  var standardQuizAnalysis = new _QuizAnalysis.default((0, _immutable.fromJS)({
    quizId: quizId,
    quizAnalysis: {
      centile: Array.from({
        length: 100
      }, function () {
        return Math.floor(Math.random() * 5);
      }),
      decile: Array.from({
        length: 10
      }, function () {
        return Math.floor(Math.random() * 5);
      }),
      scoreInfo: {
        resultSum: 5,
        resultCount: 1
      }
    },
    batchTimestamp: new Date()
  }));
  var testbed = createTestbed(_QuizAnalysisOverview.default, {
    getQuizAnalysis: getQuizAnalysisStub,
    quizAnalysis: standardQuizAnalysis,
    quizId: quizId,
    quizTitle: 'Title'
  });
  shouldRenderComponent(testbed, {}, _QuizAnalysisOverview.default);
  shouldRenderComponent(testbed, {}, _CentileDistribution.default);
  it('should render the quiz title', function () {
    testbed.render();
    expect(testbed.getText()).to.include('Title');
  });
  it('should render the score info', function () {
    testbed.render();
    var output = testbed.getText();
    expect(output).to.include('Mean Score');
    expect(output).to.include('High Score');
    expect(output).to.include('Low Score');
    expect(output).to.include('Standard Deviation');
    expect(output).to.include('Mean Elapsed Time');
    expect(output).to.include('Cronbach\'s Alpha');
  });
  it('renders last updated date', function () {
    testbed.render();
    var output = testbed.getText();
    expect(output).to.include('Data Last Updated');
  });
});