import { bindActionCreators } from 'redux'
import { ADD_ALERT } from '@instructure/quiz-common/lib/constants'
import store from '../../../reduxStore'
import * as alertActions from '../../actions/alerts'

function createBoundActionCreators (dispatch = store.dispatch) {
  return bindActionCreators(alertActions, dispatch)
}

describe('alertHelpers', () => {
  it('should trigger additional actions', () => {
    const dispatchSpy = sinon.spy()
    createBoundActionCreators(dispatchSpy).addError('message')
    expect(dispatchSpy).to.have.been.calledOnce()
    expect(dispatchSpy.firstCall.args[0].type).to.eq(ADD_ALERT)
  })
})
