import Quiz from '../../../../../records/Quiz'

import QuizInfo from '../QuizInfo'
import ScrollableQuizTitle from '../../title/Title'
import ScrollableQuizInstructions from '../../instructions/Instructions'

describe('QuizInfo Component', () => {
  const QuizInfoWithContext = withContext(QuizInfo)
  const testbed = createTestbed(QuizInfoWithContext, {
    quiz: new Quiz({
      title: 'History of Rome: Quiz 1',
      instructions: 'Do your best!'
    }),
    actions: {}
  })

  shouldRenderComponent(
    testbed, {}, QuizInfoWithContext
  )

  it('should render a QuizTitle', () => {
    testbed.render()
    const builder = testbed.findChildByType(ScrollableQuizTitle)
    expect(builder).to.not.be.undefined()
  })

  it('should render a QuizInstructions', () => {
    testbed.render()
    const builder = testbed.findChildByType(ScrollableQuizInstructions)
    expect(builder).to.not.be.undefined()
  })

  describe('a11y tests', () => {
    it('should meet a11y standards', (done) => {
      testbed.render()
      testbed.checkA11yStandards(done)
    })
  })
})
