<commit_before>const chai = require('chai');
const assert = chai.assert;

var Game = require('../lib/game');
var Board = require('../lib/board');
var Square = require('../lib/square');
var Piece = require('../lib/piece');
var King = require('../lib/pieces/king');
var Bishop = require('../lib/pieces/bishop');
var Pawn = require('../lib/pieces/pawn');

describe('Piece', function () {

  beforeEach (function () {
    this.square = new Square ("board", 0, 0);
  });

  it('should instantiate a new piece', function () {
    let piece = new Piece ();
    assert.isObject(piece);
  });

  it('should know its color', function () {
    let piece = new Piece (this.square, "black");
    assert.equal(piece.color, "black");
  });

  it('should know its square', function () {
    let piece = new Piece (this.square, "black");
    assert.equal(piece.square, this.square);
  });

  it('should start its move counter at 0', function () {
    let piece = new Piece ();
    assert.equal(piece.moveCount, 0);
  });

  it('should cannot move if result puts own king in check', function () {
    var board = new Board ();
    board.createSquares();
    var game = new Game (board);
    board.game = game;
    var square = board.findSquare(1, 6);
    var king = new King (square, "white");
    square.piece = king;
    var squareTwo = board.findSquare(4,3);<commit_msg>Adds loader dependency.<commit_after>const chai = require('chai');
const assert = chai.assert;

var Game = require('../lib/game');
var Board = require('../lib/board');
var Loader = require('../lib/loader');
var Square = require('../lib/square');
var Piece = require('../lib/piece');
var King = require('../lib/pieces/king');
var Bishop = require('../lib/pieces/bishop');
var Pawn = require('../lib/pieces/pawn');

describe('Piece', function () {

  beforeEach (function () {
    this.square = new Square ("board", 0, 0);
  });

  it('should instantiate a new piece', function () {
    let piece = new Piece ();
    assert.isObject(piece);
  });

  it('should know its color', function () {
    let piece = new Piece (this.square, "black");
    assert.equal(piece.color, "black");
  });

  it('should know its square', function () {
    let piece = new Piece (this.square, "black");
    assert.equal(piece.square, this.square);
  });

  it('should start its move counter at 0', function () {
    let piece = new Piece ();
    assert.equal(piece.moveCount, 0);
  });

  it('should cannot move if result puts own king in check', function () {
    var board = new Board ();
    var loader = new Loader (board);
    loader.createSquares();
    board.squares = loader.squares;
    var game = new Game (board);
    board.game = game;
    var square = board.findSquare(1, 6);
    var king = new King (square, "white");
    square.piece = king;
    var squareTwo = board.findSquare(4,3);
{'fraction_non_alphanumeric': 0.17684433462760324, 'fraction_numerical': 0.0056477232615601836, 'mean_word_length': 3.300455235204856, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7086475', 'n_tokens_mistral': 909, 'n_tokens_neox': 872, 'n_words': 265}