import * as actions from '../banks'
import {
  ADD_BANKS,
  ASSOCIATE_ENTRIES,
  DISASSOCIATE_ENTRY,
  REMOVE_BANK,
  ARCHIVE_BANK
} from '@instructure/quiz-common/lib/constants'

describe('banks actions creators', () => {
  describe('#addBanks', () => {
    it('returns a well-formed and correct action', () => {
      expect(actions.addBanks([{}])).to.deep.equal({
        type: ADD_BANKS,
        payload: [{}]
      })
    })
  })

  describe('#associateEntries', () => {
    it('returns a well-formed and correct action', () => {
      expect(actions.associateEntries(123, [1, 2])).to.deep.equal({
        type: ASSOCIATE_ENTRIES,
        payload: { bankId: 123, bankEntryIds: [1, 2] }
      })
    })
  })

  describe('#disassociateEntry', () => {
    it('returns a well-formed and correct action', () => {
      expect(actions.disassociateEntry(123, 2)).to.deep.equal({
        type: DISASSOCIATE_ENTRY,
        payload: { bankId: 123, bankEntryId: 2 }
      })
    })
  })

  describe('#removebank', () => {
    it('returns a well-formed and correct action', () => {
      expect(actions.removeBank('7')).to.deep.equal({
        type: REMOVE_BANK,
        payload: '7'
      })
    })
  })

  describe('#archiveBank', () => {
    it('returns a well-formed and correct action', () => {
      expect(actions.archiveBank('5')).to.deep.equal({
        type: ARCHIVE_BANK,
        payload: '5'
      })
    })
  })
})
