Total Complexity | 9 |
Complexity/F | 1 |
Lines of Code | 28 |
Function Count | 9 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | 'use strict'; |
||
2 | |||
3 | var expect = require('expect.js'); |
||
4 | |||
5 | var Position = require('../lib/position'); |
||
6 | |||
7 | describe('Position', function() { |
||
8 | it('should throw an error when X is not valid', function () { |
||
9 | expect(function() { |
||
10 | new Position({x:false,y:1}, 'N'); |
||
11 | }).to.throwException(/Coordinates are not valid/); |
||
12 | }); |
||
13 | it('should throw an error when Y is not valid', function () { |
||
14 | expect(function() { |
||
15 | new Position({x:1,y:false}, 'N'); |
||
16 | }).to.throwException(/Coordinates are not valid/); |
||
17 | }); |
||
18 | it('should throw an error when C is not valid', function () { |
||
19 | expect(function() { |
||
20 | new Position({x:1,y:1}, false); |
||
21 | }).to.throwException(/Cardinal point is not valid/); |
||
22 | }); |
||
23 | it('should not throw an error when position is valid', function () { |
||
24 | expect(function() { |
||
25 | new Position({x:1,y:1}, 'N'); |
||
26 | }).to.not.throwException(); |
||
27 | }); |
||
28 | }); |