"use strict";

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

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

var _immutable = require("immutable");

var _sharedBanks = _interopRequireDefault(require("../sharedBanks"));

var actions = _interopRequireWildcard(require("../../actions/sharedBanks"));

describe('sharedBanks reducer', function () {
  describe('shareBanks', function () {
    it('updates state correctly', function () {
      var initialState = (0, _immutable.fromJS)({
        1: {
          id: 1,
          uuid: '1',
          bankId: '1',
          permission: 'canEdit'
        },
        2: {
          id: 2,
          uuid: '2',
          bankId: '2',
          permission: 'canEdit'
        }
      });
      var action = actions.addSharedBanks({
        3: {
          id: 3,
          uuid: '3',
          bankId: '3',
          permission: 'canEdit'
        }
      });
      var nextState = (0, _sharedBanks.default)(initialState, action);
      expect(nextState.getIn(['1', 'bankId'])).to.eq('1');
      expect(nextState.getIn(['3', 'bankId'])).to.eq('3');
    });
  });
  describe('removeBanks', function () {
    it('updates state correctly', function () {
      var initialState = (0, _immutable.fromJS)({
        1: {
          id: 1,
          uuid: '1',
          bankId: '1',
          permission: 'canEdit'
        },
        2: {
          id: 2,
          uuid: '2',
          bankId: '2',
          permission: 'canEdit'
        }
      });
      var action = actions.removeSharedBank('3');
      var nextState = (0, _sharedBanks.default)(initialState, action);
      expect(nextState.getIn(['1', 'bankId'])).to.eq('1');
      expect(nextState.getIn(['3', 'bankId'])).to.be.undefined();
    });
  });
});