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.
Passed
Pull Request — master (#8)
by Cedric
01:27
created

test/lib/utils.spec.js   A

Complexity

Total Complexity 14
Complexity/F 1

Size

Lines of Code 87
Function Count 14

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
wmc 14
c 1
b 0
f 0
nc 1
mnd 0
bc 14
fnc 14
dl 0
loc 87
rs 10
bpm 1
cpm 1
noi 32

1 Function

Rating   Name   Duplication   Size   Complexity  
A utils.spec.js ➔ ??? 0 22 1
1
import {expect} from 'chai';
2
3
import {autoCast, castString, isColor, isFloat, isInt} from '../../src/lib/utils';
4
5
6
describe('autoCast  utility', () => {
7
    it('should cast to an integer', () => {
8
        expect(autoCast('42')).to.equal(42);
9
    });
10
11
    it('should cast to a float', () => {
12
        expect(autoCast('42.0')).to.equal(42.0);
13
        expect(autoCast('42.42')).to.equal(42.42);
14
    });
15
16
    it('should cast to a boolean', () => {
17
        expect(autoCast('true')).to.be.true;
0 ignored issues
show
introduced by
The result of the property access to expect(autoCast("true")).to.be.true is not used.
Loading history...
18
        expect(autoCast('True')).to.be.true;
0 ignored issues
show
introduced by
The result of the property access to expect(autoCast("True")).to.be.true is not used.
Loading history...
19
20
        expect(autoCast('false')).to.be.false;
0 ignored issues
show
introduced by
The result of the property access to expect(autoCast("false")).to.be.false is not used.
Loading history...
21
        expect(autoCast('False')).to.be.false;
0 ignored issues
show
introduced by
The result of the property access to expect(autoCast("False")).to.be.false is not used.
Loading history...
22
    });
23
24
    it('should return a string if no other type matches', () => {
25
        expect(autoCast('foo')).to.equal('foo');
26
    });
27
});
28
29
30
describe('castString  utility', () => {
31
    it('should return a lowercase string', () => {
32
        expect(castString('FOO')).to.equal('foo');
33
        expect(castString('foo')).to.equal('foo');
34
        expect(castString('fOo')).to.equal('foo');
35
    });
36
37
    it('should return a string', () => {
38
        expect(castString(42)).to.equal('42');
39
        expect(castString(42.42)).to.equal('42.42');
40
        expect(castString(true)).to.equal('true');
41
        expect(castString(false)).to.equal('false');
42
    });
43
});
44
45
describe('isInt  utility', () => {
46
    it('should work as expected', () => {
47
        expect(isInt('187')).to.be.true;
0 ignored issues
show
introduced by
The result of the property access to expect(isInt("187")).to.be.true is not used.
Loading history...
48
        expect(isInt(187)).to.be.true;
0 ignored issues
show
introduced by
The result of the property access to expect(isInt(187)).to.be.true is not used.
Loading history...
49
        expect(isInt('-2')).to.be.true;
0 ignored issues
show
introduced by
The result of the property access to expect(isInt("-2")).to.be.true is not used.
Loading history...
50
        expect(isInt(-'1')).to.be.true;
0 ignored issues
show
introduced by
The result of the property access to expect(isInt(-"1")).to.be.true is not used.
Loading history...
51
        expect(isInt('10e1')).to.be.true;
0 ignored issues
show
introduced by
The result of the property access to expect(isInt("10e1")).to.be.true is not used.
Loading history...
52
        expect(isInt(10e1)).to.be.true;
0 ignored issues
show
introduced by
The result of the property access to expect(isInt(100)).to.be.true is not used.
Loading history...
53
        expect(isInt('1.2')).to.be.false;
0 ignored issues
show
introduced by
The result of the property access to expect(isInt("1.2")).to.be.false is not used.
Loading history...
54
        expect(isInt('foo')).to.be.false;
0 ignored issues
show
introduced by
The result of the property access to expect(isInt("foo")).to.be.false is not used.
Loading history...
55
    });
56
});
57
58
describe('isFloat  utility', () => {
59
    it('should work as expected', () => {
60
        expect(isFloat('0.2')).to.be.true;
0 ignored issues
show
introduced by
The result of the property access to expect(isFloat("0.2")).to.be.true is not used.
Loading history...
61
        expect(isFloat(0.2)).to.be.true;
0 ignored issues
show
introduced by
The result of the property access to expect(isFloat(0.2)).to.be.true is not used.
Loading history...
62
        expect(isFloat('.2')).to.be.true;
0 ignored issues
show
introduced by
The result of the property access to expect(isFloat(".2")).to.be.true is not used.
Loading history...
63
        expect(isFloat('-.2')).to.be.true;
0 ignored issues
show
introduced by
The result of the property access to expect(isFloat("-.2")).to.be.true is not used.
Loading history...
64
        expect(isFloat(-'.2')).to.be.true;
0 ignored issues
show
introduced by
The result of the property access to expect(isFloat(-".2")).to.be.true is not used.
Loading history...
65
        expect(isFloat(-.2)).to.be.true;
0 ignored issues
show
introduced by
The result of the property access to expect(isFloat(-0.2)).to.be.true is not used.
Loading history...
66
        expect(isFloat('u.2')).to.be.false;
0 ignored issues
show
introduced by
The result of the property access to expect(isFloat("u.2")).to.be.false is not used.
Loading history...
67
        expect(isFloat('2')).to.be.false;
0 ignored issues
show
introduced by
The result of the property access to expect(isFloat("2")).to.be.false is not used.
Loading history...
68
        expect(isFloat('0.2u')).to.be.false;
0 ignored issues
show
introduced by
The result of the property access to expect(isFloat("0.2u")).to.be.false is not used.
Loading history...
69
        expect(isFloat('foo')).to.be.false;
0 ignored issues
show
introduced by
The result of the property access to expect(isFloat("foo")).to.be.false is not used.
Loading history...
70
    });
71
});
72
73
describe('isColor  utility', () => {
74
    it('should work as expected', () => {
75
        expect(isColor('#ffffff')).to.be.true;
0 ignored issues
show
introduced by
The result of the property access to expect(isColor("#ffffff")).to.be.true is not used.
Loading history...
76
        expect(isColor('ffffff')).to.be.true;
0 ignored issues
show
introduced by
The result of the property access to expect(isColor("ffffff")).to.be.true is not used.
Loading history...
77
        expect(isColor('#fFfFfF')).to.be.true;
0 ignored issues
show
introduced by
The result of the property access to expect(isColor("#fFfFfF")).to.be.true is not used.
Loading history...
78
        expect(isColor('fFfFfF')).to.be.true;
0 ignored issues
show
introduced by
The result of the property access to expect(isColor("fFfFfF")).to.be.true is not used.
Loading history...
79
        expect(isColor('#012344')).to.be.true;
0 ignored issues
show
introduced by
The result of the property access to expect(isColor("#012344")).to.be.true is not used.
Loading history...
80
        expect(isColor('012344')).to.be.true;
0 ignored issues
show
introduced by
The result of the property access to expect(isColor("012344")).to.be.true is not used.
Loading history...
81
82
        expect(isColor('#01244')).to.be.false;
0 ignored issues
show
introduced by
The result of the property access to expect(isColor("#01244")).to.be.false is not used.
Loading history...
83
        expect(isColor('01244')).to.be.false;
0 ignored issues
show
introduced by
The result of the property access to expect(isColor("01244")).to.be.false is not used.
Loading history...
84
        expect(isColor('#01244G')).to.be.false;
0 ignored issues
show
introduced by
The result of the property access to expect(isColor("#01244G")).to.be.false is not used.
Loading history...
85
        expect(isColor('01244G')).to.be.false;
0 ignored issues
show
introduced by
The result of the property access to expect(isColor("01244G")).to.be.false is not used.
Loading history...
86
    });
87
});
88