import Board from '../../frontend/src/shogi/board';
import Piece from '../../frontend/src/shogi/piece';
import sinon from 'sinon';
import memo from 'memo-is';

describe('Borad', () => {
  describe('#enhanceMovablePoint', () => {
    context('porn', () => {
      var board = memo().is(() => {
        return (
          [
            ['l', 'n', 's', 'g', 'k', 'g', 's', 'n', 'l'],
            ['*', 'b', '*', '*', '*', '*', '*', 'r', '*'],
            ['p', 'p', 'p', 'p', 'p', 'p', 'p', 'p', 'p'],
            ['*', '*', '*', '*', '*', '*', '*', '*', '*'],
            ['*', '*', '*', '*', '*', '*', '*', '*', '*'],
            ['*', '*', '*', '*', '*', '*', '*', 'P', '*'],
            ['P', 'P', 'P', 'P', 'P', 'P', 'P', '*', 'P'],
            ['*', 'B', '*', '*', '*', '*', '*', 'R', '*'],
            ['L', 'N', 'S', 'G', 'K', 'G', 'S', 'N', 'L']
          ]
        );
      });

      it('change property of piece that is moved', () => {
        var testBoard = new Board;
        var piece = new Piece('P', 2, 6);
        testBoard.board = board;
        testBoard.enhanceMovablePoint(piece);

        var result = [];

        var movable = testBoard.board().forEach((row) => {
          var cell = row.filter((cell) => { return(cell.isMovable); });
          if (cell.length) { result.push(cell); }
        });
        result.should.eql([new Piece('*', 2, 5)]);
      });
    });
  });
});

@@ -1015,16 +1015,17 @@
  2, 6);%0A
+%0A
         
@@ -1038,21 +1038,23 @@
 ard.
-b
+setB
 oard
- = 
+(
 board
+)
 ;%0A  
@@ -1123,17 +1123,16 @@
 t = %5B%5D;%0A
-%0A
         
@@ -1160,18 +1160,16 @@
 rd.board
-()
 .forEach
@@ -1240,11 +1240,9 @@
 ell.
-isM
+m
 ovab
@@ -1316,22 +1316,44 @@
 %7D);%0A
+%0A
        
+ %5B%5D.concat.apply(%5B%5D,
  result
+)
 .sho
@@ -1360,16 +1360,27 @@
 uld.eql(
+%0A          
 %5Bnew Pie
@@ -1395,10 +1395,25 @@
 2, 5
-)%5D
+, true)%5D%0A        
 );%0A 

Update spec