import * as CONST from '../constants/actionTypes';
import Shogi from '../src/shogi';

const initialState = {
  holdingPiece: undefined,
  board: Shogi.Board,
  blackPieceStand: [],
  whitePieceStand: []
};

export default function shogi(state = initialState, action) {
  switch (action.type) {
  case CONST.HOLD_PIECE:
    if (action.piece.isEmpty()) return state;

    return Object.assign(
      {},
      state,
      { holdingPiece: action.piece }
    );
  case CONST.RELEASE_PIECE:
    if (action.piece.isEmpty()) return state;

    return Object.assign(
      {},
      state,
      { board: state.board.cloneBoard().clearAttrs(), holdingPiece: undefined }
    );
  case CONST.ENHANCE_MOVABLE_POINT:
    if (action.piece.isEmpty()) return state;

    return Object.assign(
      {},
      state,
      { board: state.board.enhanceMovablePoint(action.piece) }
    );
  case CONST.MOVE_PIECE:
    const newBoard = state.board.movePiece(state.holdingPiece, action.piece);

    return Object.assign(
      {},
      state,
      {
        board: newBoard,
        holdingPiece: undefined
      }
    );
  case CONST.CAPTURE_BLACK_PIECE:
    return Object.assign(
      {},
      state,
      {
        blackPieceStand: state.blackPieceStand.concat([action.piece.toOpponentPiece()])
      }
    );
  case CONST.CAPTURE_WHITE_PIECE:
    return Object.assign(
      {},
      state,
      {
        whitePieceStand: state.whitePieceStand.concat([action.piece.toOpponentPiece()])
      }
    );
  default:
    return state;
  }
}

@@ -1188,24 +1188,16 @@
 %0A      %7B
-%0A       
  blackPi
@@ -1260,38 +1260,32 @@
 pponentPiece()%5D)
-%0A     
  %7D%0A    );%0A  case
@@ -1368,24 +1368,16 @@
 %0A      %7B
-%0A       
  whitePi
@@ -1448,22 +1448,16 @@
 iece()%5D)
-%0A     
  %7D%0A    )

Fix multiline object.