"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

var _immutable = require("immutable");

var _index = _interopRequireWildcard(require("../index"));

describe('connected BanksList', function () {
  var fakeState = (0, _immutable.fromJS)({
    banks: {
      1: {
        id: '1',
        title: 'B',
        updatedAt: Date.now()
      },
      2: {
        id: '2',
        title: 'A',
        updatedAt: Date.now()
      }
    }
  });
  describe('mapStateToProps', function () {
    it('maps recordIds to banks state', function () {
      var props = (0, _index.mapStateToProps)(fakeState, {
        recordIds: ['2', '1']
      });
      expect(props.banks.map(function (b) {
        return b.title;
      }).toJS()).to.eql(['A', 'B']);
    });
  });
  describe('BanksList Container', function () {
    var ConnectedBanksList = withContext(_index.default);
    var testbed = createTestbed(ConnectedBanksList, {
      setUi: sinon.stub(),
      openModal: sinon.stub(),
      navigateToBank: sinon.stub(),
      banks: new _immutable.List(),
      recordIds: []
    });
    useFakeFetching({
      dispatchStub: sinon.stub(),
      getStateStub: sinon.stub(),
      fetchStub: sinon.stub()
    });
    shouldRenderComponent(testbed, {}, _index.default);
  });
});