Passed
Push — master ( bb6f81...12291e )
by Christofer
57s
created

alse if closedꞌ)   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 7
rs 9.4285
c 1
b 0
f 0
1
var assert = require('assert');
2
const game = require("../../src/chess/Game");
3
4
describe('Game module', function() {
5
    describe('init the game', function() {
6
        it("should have pieces on the board", function() {
7
            game.init();
8
            assert.equal(game.p1.color, "white");
9
            assert.equal(game.p2.color, "black");
10
            assert.equal(game.p2.color, "black");
11
12
            let square = game.board.getSquare("B", 1);
13
            let pawn = game.p1.pawns[0];
14
15
            assert.equal(square, pawn);
16
        });
17
18
19
        it("player should have all pieces", function() {
20
            game.init();
21
            assert.equal(game.p1.pawns.length, 8);
22
            assert.equal(game.p2.bishops.length, 2);
23
        });
24
25
        it("return true if open false if closed", function() {
26
            // B2 to F2 open
27
            assert.equal(game.board.checkRow("B", 2, "F", 2), true)
28
29
            // B2 to B5 Closed
30
            assert.equal(game.board.checkRow("B", 5, "B", 2), false)
31
        });
32
    });
33
});
34