GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Branch master (8f2e94)
by Joss
01:13
created

test/grid.js   A

Complexity

Total Complexity 14
Complexity/F 1

Size

Lines of Code 51
Function Count 14

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
nc 1
dl 0
loc 51
rs 10
c 1
b 0
f 0
wmc 14
mnd 0
bc 14
fnc 14
bpm 1
cpm 1
noi 2
1
'use strict';
2
3
var expect = require('expect.js');
4
var Grid = require('../lib/grid');
5
var Position = require('../lib/position');
6
7
describe('Grid', function() {
8
    describe('setItemPosition', function () {
9
        var grid = new Grid(new Position({x:5,y:5}, 'N'));
10
        it('should add a position to occupation object', function () {
11
            var position = new Position({x:1,y:1}, 'N');
12
            grid.setItemPosition(0, position);
13
            expect(grid.occupation[0]).to.equal(position);
14
        });
15
        it('should update an item’s position in occupation object', function () {
16
            var position = new Position({x:2,y:2}, 'S');
17
            grid.setItemPosition(0, position);
18
            expect(grid.occupation[0]).to.equal(position);
19
        });
20
    });
21
    describe('getCellOccupation', function () {
22
        var grid = new Grid(new Position({x:5,y:5}, 'N')),
23
            itemPosition = new Position({x:4,y:4}, 'N');
24
        grid.setItemPosition(0, itemPosition); // set a test item
25
        it('should return ’id’ of item who match an occupied cell', function () {
26
            var position = new Position({x:4,y:4}, 'N');
27
            expect(grid.getCellOccupation(position)).to.equal(0);
28
        });
29
        it('should return ’null’ if no item has been found for the given cell', function () {
30
            var position = new Position({x:3,y:3}, 'N');
31
            expect(grid.getCellOccupation(position)).to.equal(null);
32
        });
33
        it('should throw an error when position is not valid', function () {
34
            expect(function() {
35
                grid.getCellOccupation(false);
36
            }).to.throwException(/Position is not valid/);
37
        });
38
    });
39
    describe('isValid', function () {
40
        it('should throw an error when X is not valid', function () {
41
            expect(function() {
42
                new Grid({x:false,y:5});
43
            }).to.throwException(/Coordinates are not valid/);
44
        });
45
        it('should throw an error when Y is not valid', function () {
46
            expect(function() {
47
                new Grid({x:5,y:false});
48
            }).to.throwException(/Coordinates are not valid/);
49
        });
50
    });
51
});