import { Map } from 'immutable'

import Bank from '../../../../../../../common/records/Bank'
import QuizEntry from '../../../../../../../common/records/QuizEntry'
import { mapStateToProps } from '../index'

describe('QuizEntryBank Container', () => {
  const fakeQuizEntry = new QuizEntry()
  const workingBank = new Bank({ id: '1', entryCount: 5 })
  workingBank.properties = Map()
  sinon.stub(fakeQuizEntry, 'getWorkingInstance').returns(fakeQuizEntry)
  sinon.stub(fakeQuizEntry, 'getEntry').returns(workingBank)
  const defaultProps = {
    displayPosition: 1,
    pointsPossible: '0',
    quizEntry: fakeQuizEntry,
    changeQuizEntryPoints: () => {},
    changeQuizEntryProperties: () => {},
    changeQuizEntryEntry: () => {},
    clearModifications: () => {},
    updateQuizEntry: () => {},
    questionSelection: 'all',
    sampleNum: '0',
    quizId: '0'
  }

  it('infers questionSelection from sampleNum in mapStateToProps', () => {
    const newProps = mapStateToProps({ get: () => Map() }, defaultProps)
    expect(newProps.questionSelection).to.eq('all')
  })
})
