import OutcomesPerStudentReport from 'outcomes-react/lib/containers/OutcomesPerStudentReport'

import OutcomeAnalysis from '../presenter'

describe('OutcomeAnalysis', () => {
  const testbed = createTestbed(OutcomeAnalysis, {
    contextUuid: 'alphabeta',
    outcomesHost: 'foo.outcomes',
    outcomesToken: 'bar',
    quizId: '100'
  })

  it('should render OutcomesPerStudentReport component', () => {
    const loadUsersOverride = function () {}
    const showRollups = false
    const wrapper = testbed.renderShallowly({
      loadUsersOverride,
      showRollups
    })

    const report = wrapper.find(OutcomesPerStudentReport)
    expect(report.length).to.eq(1)
    expect(report.prop('contextUuid')).to.eq('alphabeta')
    expect(report.prop('host')).to.eq('foo.outcomes')
    expect(report.prop('jwt')).to.eq('bar')
    expect(report.prop('artifactType')).to.eq('quizzes.quiz')
    expect(report.prop('artifactId')).to.eq('100')
    expect(report.prop('loadUsersOverride')).to.eq(loadUsersOverride)
    expect(report.prop('showRollups')).to.eq(showRollups)
  })

  it('sets the correct default values for optional props', () => {
    const wrapper = testbed.renderShallowly()

    const report = wrapper.find(OutcomesPerStudentReport)
    expect(report.length).to.eq(1)
    expect(report.prop('loadUsersOverride')).to.be.undefined()
    expect(report.prop('showRollups')).to.be.true()
  })
})
