import { expect } from 'chai'
import { addSessionItemResults } from '../sessionItemResults'
import { ADD_SESSION_ITEM_RESULTS } from '@instructure/quiz-common/lib/constants'

describe('adding a SessionItemResult action creators', () => {
  it('returns well formed session item results', () => {
    const fakeSessionItemResults = [
      {
        id: '1',
        score: 3.0,
        attempt: 1,
        item_id: '1',
        feedback: 'hold the door'
      },
      {
        id: '2',
        score: 2.5,
        attempt: 1,
        item_id: '2',
        feedback: 'what a save!'
      }
    ]
    const addSIRAction = addSessionItemResults(fakeSessionItemResults)

    expect(addSIRAction)
      .to.deep.equal({
        type: ADD_SESSION_ITEM_RESULTS,
        payload: fakeSessionItemResults
      })
  })
})
