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

const { Board, Unit, Game } = require('../src/model');

describe('Game Functions', () => {
  describe('is valid position', () => {

    it('no collisions', () => {
      const game = new Game;
      const board = new Board(3, 2);
      const unit = new Unit();
      unit.pivot = {x: 1, y: 1};
      unit.members = [{x: 0, y: 0}, {x: 1, y: 0}];

      expect(game.isValidPosition(board, unit)).to.equal(true);
    });

    it('should not overlap filled cells', () => {
      const game = new Game;
      const board = new Board(3, 2);
      board.fill(1, 1);
      const unit = new Unit();

      unit.pivot = {x: 1, y: 1};
      unit.members = [{x: 0, y: 0}, {x: 1, y: 0}];
      expect(game.isValidPosition(board, unit)).to.equal(false);
    });

    it('should not leave the board', () => {
      const game = new Game;
      const board = new Board(3, 2);

      const unit = new Unit();

      unit.pivot = {x: 1, y: 1};
      unit.members = [{x: 0, y: 0}, {x: 2, y: 0}];
      expect(game.isValidPosition(board, unit)).to.equal(false);
    })
  });

  describe('lock unit on a board', () => {
    it('should lock a unit', () => {
      const game = new Game;
      const board = new Board(5, 6);
      const unit = new Unit({ x: 1, y: 0}, [{ x:  0, y: 0}, {x: 2, y: 0}, {x: 3, y: 3}]);<commit_msg>fixed tests<commit_after>const chai = require('chai'),
  assert = chai.assert,
  expect = chai.expect;

const { Board, Unit, Game } = require('../src/model');

describe('Game Functions', () => {
  describe('is valid position', () => {

    it('no collisions', () => {
      const game = new Game;
      const board = new Board(3, 2);
      const unit = new Unit({x: 1, y: 1}, [{x: 0, y: 0}, {x: 1, y: 0}]);
      expect(game.isValidPosition(board, unit)).to.equal(true);
    });

    it('should not overlap filled cells', () => {
      const game = new Game;
      const board = new Board(3, 2);
      board.fill(1, 1);
      const unit1 = new Unit({x: 1, y: 1}, [{x: 0, y: 0}, {x: 1, y: 0}]);
      expect(game.isValidPosition(board, unit1)).to.equal(true);
      const unit2 = new Unit({x: 1, y: 1}, [{x: 0, y: 0}, {x: 1, y: 1}]);
      expect(game.isValidPosition(board, unit2)).to.equal(false);
    });

    it('should not leave the board', () => {
      const game = new Game;
      const board = new Board(3, 2);
      const unit = new Unit({x: 1, y: 1}, [{x: 0, y: 0}, {x: 3, y: 0}]);
      expect(game.isValidPosition(board, unit)).to.equal(false);
    });
  });

  describe('lock unit on a board', () => {
    it('should lock a unit', () => {
      const game = new Game;
      const board = new Board(5, 6);
      const unit = new Unit({ x: 1, y: 0}, [{ x:  0, y: 0}, {x: 2, y: 0}, {x: 3, y: 3}]);
{'fraction_non_alphanumeric': 0.20827389443651925, 'fraction_numerical': 0.029243937232524966, 'mean_word_length': 2.550632911392405, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '7512351', 'n_tokens_mistral': 1074, 'n_tokens_neox': 996, 'n_words': 320}