<commit_before>import Board from '../../../../frontend/src/shogi/board';
import Piece from '../../../../frontend/src/shogi/piece';
import memo from 'memo-is';
import _ from 'lodash';

describe('#enhancePlaceablePoint', () => {
  describe('black', () => {
    context('the normal pattern', () => {
      const position = memo().is(() => {
        return (
          [
            ['*', '*', '*'],
            ['P', '*', 'p'],
            ['*', '*', '*'],
            ['*', '*', '*']
          ]
        );
      });

      it('change property of piece that is placeable', () => {
        const board = new Board(position());
        const piece = Piece.create({ type: 'P', x: 0, y: 0 });

        const placeablePieces = board.enhancePlaceablePoint(piece).board.map((row) => {
          return (
            row.filter((cell) => { return(cell.isPlaced); })
          );
        });

        _.flattenDeep(placeablePieces).should.eql(
          [
            Piece.create({ type: '*', x: 8, y: 2, isPlaced: true}),
            Piece.create({ type: '*', x: 8, y: 3, isPlaced: true}),
            Piece.create({ type: '*', x: 7, y: 3, isPlaced: true}),
            Piece.create({ type: '*', x: 8, y: 4, isPlaced: true}),
            Piece.create({ type: '*', x: 7, y: 4, isPlaced: true}),
          ]
        );
      });
    });

    context.skip('`UCHI FU ZUME`', () => {
    });
  });

  describe('white', () => {
    context('the normal pattern', () => {
      const position = memo().is(() => {
        return (
          [
            ['*', '*'],
            ['*', '*'],
            ['*', '*'],
            ['*', '*'],
            ['*', '*'],
            ['*', 'p'],
            ['b', '*'],
            ['*', '*'],
            ['*', '*'],
          ]
        );
      });

      it('change property of piece that is placeable', () => {
        const board = new Board(position());
        const piece = Piece.create({ type: 'p', x: 0, y: 0 });

        const placeablePieces = board.enhancePlaceablePoint(piece).board.map((row) => {
          return (
            row.filter((cell) => { return(cell.isPlaced); })
          );
        });

        _.flattenDeep(placeablePieces).should.eql(
          [
            Piece.create({ type: '*', x: 9, y: 1, isPlaced: true}),
            Piece.create({ type: '*', x: 9, y: 2, isPlaced: true}),
            Piece.create({ type: '*', x: 9, y: 3, isPlaced: true}),
            Piece.create({ type: '*', x: 9, y: 4, isPlaced: true}),
            Piece.create({ type: '*', x: 9, y: 5, isPlaced: true}),
            Piece.create({ type: '*', x: 9, y: 6, isPlaced: true}),
            Piece.create({ type: '*', x: 9, y: 8, isPlaced: true}),
          ]
        );
      });
    });

    context.skip('`UCHI FU ZUME`', () => {
    });
  });
});<commit_msg>Refactor test. Add `Pawn` describe<commit_after>import Board from '../../../../frontend/src/shogi/board';
import Piece from '../../../../frontend/src/shogi/piece';
import memo from 'memo-is';
import _ from 'lodash';

describe('Pawn', () => {
  describe('#enhancePlaceablePoint', () => {
    describe('black', () => {
      context('the normal pattern', () => {
        const position = memo().is(() => {
          return (
            [
              ['*', '*', '*'],
              ['P', '*', 'p'],
              ['*', '*', '*'],
              ['*', '*', '*']
            ]
          );
        });

        it('change property of piece that is placeable', () => {
          const board = new Board(position());
          const piece = Piece.create({ type: 'P', x: 0, y: 0 });

          const placeablePieces = board.enhancePlaceablePoint(piece).board.map((row) => {
            return (
              row.filter((cell) => { return(cell.isPlaced); })
            );
          });

          _.flattenDeep(placeablePieces).should.eql(
            [
              Piece.create({ type: '*', x: 8, y: 2, isPlaced: true}),
              Piece.create({ type: '*', x: 8, y: 3, isPlaced: true}),
              Piece.create({ type: '*', x: 7, y: 3, isPlaced: true}),
              Piece.create({ type: '*', x: 8, y: 4, isPlaced: true}),
              Piece.create({ type: '*', x: 7, y: 4, isPlaced: true}),
            ]
          );
        });
      });

      context.skip('`UCHI FU ZUME`', () => {
      });
    });

    describe('white', () => {
      context('the normal pattern', () => {
        const position = memo().is(() => {
          return (
            [
              ['*', '*'],
              ['*', '*'],
              ['*', '*'],
              ['*', '*'],
              ['*', '*'],
              ['*', 'p'],
              ['b', '*'],
              ['*', '*'],
              ['*', '*'],
            ]
          );
        });

        it('change property of piece that is placeable', () => {
          const board = new Board(position());
          const piece = Piece.create({ type: 'p', x: 0, y: 0 });

          const placeablePieces = board.enhancePlaceablePoint(piece).board.map((row) => {
            return (
              row.filter((cell) => { return(cell.isPlaced); })
            );
          });

          _.flattenDeep(placeablePieces).should.eql(
            [
              Piece.create({ type: '*', x: 9, y: 1, isPlaced: true}),
              Piece.create({ type: '*', x: 9, y: 2, isPlaced: true}),
              Piece.create({ type: '*', x: 9, y: 3, isPlaced: true}),
              Piece.create({ type: '*', x: 9, y: 4, isPlaced: true}),
              Piece.create({ type: '*', x: 9, y: 5, isPlaced: true}),
              Piece.create({ type: '*', x: 9, y: 6, isPlaced: true}),
              Piece.create({ type: '*', x: 9, y: 8, isPlaced: true}),
            ]
          );
        });
      });

      context.skip('`UCHI FU ZUME`', () => {
      });
    });
  });
});
{'fraction_non_alphanumeric': 0.22772790055248618, 'fraction_numerical': 0.009668508287292817, 'mean_word_length': 1.5644090305444887, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2627589', 'n_tokens_mistral': 1951, 'n_tokens_neox': 1818, 'n_words': 389}