import { fromJS, List } from 'immutable'
import { mapStateToProps } from '../index'

describe('connected BankEntriesList', () => {
  const fakeState = fromJS({ bankEntries: {
    1: { entryType: 'Item' },
    2: { entryType: 'Other' }
  } })
  const fakeProps = {
    recordIds: List(['1', '2'])
  }

  describe('mapStateToProps', () => {
    it('maps recordIds to bankEntries state, sorted by title', () => {
      const props = mapStateToProps(fakeState, fakeProps)
      expect(props.bankEntries.map((b) => b.entryType).toJS()).to.eql(['Item', 'Other'])
    })
  })
})
