import {
  clearErrorsShowing,
  hideError,
  showError
} from '../errorsShowing'

import {
  CLEAR_ERRORS_SHOWING,
  HIDE_ERROR,
  SHOW_ERROR
} from '@instructure/quiz-common/lib/constants'

describe('errorsShowing action creators', () => {
  it('returns a clear_errors_showing action', () => {
    expect(clearErrorsShowing()).to.eql({type: CLEAR_ERRORS_SHOWING, payload: {}})
  })

  it('returns a well-formed show error action', () => {
    const showErrorAction = showError('someKey')

    expect(showErrorAction)
      .to.deep.equal({
        type: SHOW_ERROR,
        payload: {key: 'someKey'}
      })
  })

  it('returns a well-formed hide error action', () => {
    const hideErrorAction = hideError('aDifferentKey')

    expect(hideErrorAction)
      .to.deep.equal({
        type: HIDE_ERROR,
        payload: {key: 'aDifferentKey'}
      })
  })
})
